2

I have been trying to install tensorflow on my new machine for weeks now, and no matter what I do, I can't seem to get tensorflow to properly import into python. As soon as I try:
import tensorflow as tf
I get an error, the last paragraph of which results in:
Traceback (most recent call last):
File "C:\Users\solli\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\solli\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\solli\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\solli\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

I've been trying to do everything I could think up to trace back why this would be happening, but I am stumped at this point.
According to this thread "On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error", the issue lay in a lack of MSVCP140.dll (whether it wasn't there at all or no set path variable). But when I search for it:
> where MSVCP140.DLL
C:\Windows\System32\msvcp140.dll
C:\Users\solli\Anaconda3\envs\tensorflow-gpu\msvcp140.dll
C:\Users\solli\Anaconda3\envs\tensorflow-gpu\Library\bin\msvcp140.dll
C:\Users\solli\Anaconda3\msvcp140.dll
C:\Users\solli\Anaconda3\Library\bin\msvcp140.dll
Given I am new to Windows (this went a lot easier on the linux partition), but as far as I understand, that means that the path variable (and python itself should) find the msvcp140.dll module[s]. Any and all help would be greatly appreciated!

Community
  • 1
  • 1
  • Is this replicate of ?? http://stackoverflow.com/questions/43892150/tensorflow-on-gpu – Harsha Pokkalla May 10 '17 at 22:09
  • Not exactly, I'm on an i7, 1080Ti, and Win10. Besides, that one doesn't look like it got answered with a helpful result, so it doesn't do too much good either way. – Spencer Ollila May 10 '17 at 22:16
  • yeah, no answer yet. I was trying to link these questions. I saw 4 posts today with similar pywrap - windows error. – Harsha Pokkalla May 10 '17 at 22:22
  • How are you installing TF? With `pip`? Or from `conda-forge`? Some other way? – Engineero May 10 '17 at 22:22
  • I tried it with pip, pip3, and then downloaded anaconda to try and create it from there (with the google-apis link from the tensorflow site). I don't know how much it helps, but I'm trying to download the gpu-enabled version. – Spencer Ollila May 10 '17 at 22:31
  • what is the version of cuDNN you're using ? v5.1 or v6.0 ?? – Harsha Pokkalla May 11 '17 at 14:18
  • Possible duplicate of [Cannot import Tensorflow for GPU on Windows 10](https://stackoverflow.com/questions/43577923/cannot-import-tensorflow-for-gpu-on-windows-10) – aldel Aug 18 '17 at 18:59

3 Answers3

3

I'm also facing the same problem as you in installing TensorFlow-gpu in Windows 10 with Anaconda 4.2. I try many of solutions do not work for me. Until I try the solution below: https://stackoverflow.com/a/43665317/6093517

And it work for me! You can check if your cuDNN version is v6.0, and change it's file name like the solution in the %CUDA%\v8.0\bin directory.

Community
  • 1
  • 1
George Chien
  • 53
  • 1
  • 8
1

I run into the same problem and I found the reason for this was the installation of tensorflow_gpu instead of tensorflow.

So, if you are lucky enough, you can solve your problem by doing the following steps:

Step 1: pip uninstall tensorflow_gpu

Step 2: pip uninstall tensorflow (sometimes you don't need this)

Step 3: pip install tensorflow

wp78de
  • 18,207
  • 7
  • 43
  • 71
TuanNV
  • 81
  • 1
  • 4
0

I faced a similar problem. It so happens that tensorflow requires cuDNN to be in the default Path variable for environments.

If you installed cuDNN package after installing CUDA Compute Toolkit you will need to add the path to cudnn64_6.dll or cudnn64_5.dll whichever version you use to the Path variable.

If using Windows type in environment in the start menu and in the window that appears go for Environment Variables option. Then look for the Path variable and add the :../cuda/bin to it. for eg. C:/cuda/bin. This should solve it. Other things mostly take care of themselves.

Arkantos
  • 11
  • 3