0

When I try to import tensorflow I get the following error:

>>import tensorflow
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "C:\Users\...\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named _pywrap_tensorflow


Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

I installed the msvcp140.dll Redistributable as recommended here, but it didn't help. Any ideas? I am running Anaconda3 environment.

A_Matar
  • 2,210
  • 3
  • 31
  • 53
  • According to https://github.com/tensorflow/tensorflow/issues/7529, it could be that cuDNN is not properly installed. Are you sure it is in your PATH variable? – Jonas Adler Jul 08 '17 at 18:12
  • yes it is there – A_Matar Jul 08 '17 at 18:29
  • Possible duplicate of [On Windows, running "import tensorflow" generates No module named "\_pywrap\_tensorflow" error](https://stackoverflow.com/questions/42011070/on-windows-running-import-tensorflow-generates-no-module-named-pywrap-tenso) – P-Gn Jul 08 '17 at 19:18
  • 1
    See also https://stackoverflow.com/questions/44526626/issues-running-tensorflow#comment76047812_44526626 – P-Gn Jul 08 '17 at 19:18

1 Answers1

0

It turned out that tensorflow on windows requires python 3.5 or higher while my python was 2.7.8. I found out that this was the problem by the help of this great script which helps trace the source error and gives clear error messages.

A_Matar
  • 2,210
  • 3
  • 31
  • 53