0

I thought I had installed tensorflow correctly. I am using python 3.5.2 so it should work. I followed the instructions on the website and installed the CPU only version of tensorflow using pip which seemed to work. However, when, in python, I try to:

import tensorflow as tf

I get the error:

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
   return importlib.import_module(mname)
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'tensorflow.python._pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\------\Documents\-----\Computing\Python\Neural Networks\test.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Python35\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'tensorflow.python._pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow')
  File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.


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.

Does anyone know why this error is occurring and how I might be able to fix it?

J-Dave
  • 1
  • 3
  • are you using windows? – Wasi Ahmad Mar 12 '17 at 22:08
  • Yes widows with a 64 bit system – J-Dave Mar 12 '17 at 22:10
  • apology for my misleading answer. I have just installed tensorflow in Windows and it is working fine for me with a very simple `hello world` printing program. not sure what is causing you this error! can you tell me what type of program are you trying to run? can you share your code? – Wasi Ahmad Mar 12 '17 at 22:27
  • I was simply testing that the tensorflow install had worked I ran 'import tensorflow as tf' – J-Dave Mar 12 '17 at 22:30
  • you can check this thread - https://github.com/tensorflow/tensorflow/issues/7705, it might be helpful for you. – Wasi Ahmad Mar 12 '17 at 22:33
  • Duplicate of this question - http://stackoverflow.com/questions/43370953/error-while-import-tensorflow-module/43566463#43566463 – DropHit Apr 23 '17 at 23:56
  • This error might be because of You need to install the [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0) or Your CPU does not support AVX2 instructions or Your CPU/Python might be on 32 bits. –  May 04 '21 at 01:20

0 Answers0