0

I've installed Python 3.6.5, and "pip3 install --upgrade tensorflow-gpu" succeeded. Then "import tensorflow as tf" gives the following error:

    Traceback (most recent call last):
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
    return importlib.import_module(mname)
      File "C:\Program     Files\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *  # pylint: disable=redefined-builtin
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
      File "C:\Program     Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
    return importlib.import_module(mname)
      File "C:\Program     Files\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

I've searched for this error, and haven't found a match. Previous similar questions on Stack Overflow have different error messages.

Edit: I installed the default cuDNN V7.1, but Tensorflow instructions specify V7.0. I will downgrade and try again.

Edit: Downgraded to cuDNN V7.0.5, got exact same error messages.

Edit: Tried answer from suggested similar question asked a year ago, changed name of cudnn64_7.dll to cudnn64_5.dll, then to cudnn64_6.dll, both gave exact same error messages.

Ken Homer
  • 141
  • 5
  • 1
    Possible duplicate of [Cannot import Tensorflow for GPU on Windows 10](https://stackoverflow.com/questions/43577923/cannot-import-tensorflow-for-gpu-on-windows-10) – Dr. Snoopy Apr 13 '18 at 12:28
  • @MatiasValdenegro Seems like another trace, though. Don't think it's a dupe. – Bram Vanroy Apr 13 '18 at 12:31
  • @BramVanroy Yes, there are too many duplicates with the same error message, I just hit the wrong one :) – Dr. Snoopy Apr 13 '18 at 12:37

3 Answers3

0

I am also faced that problem. Install Anaconda. Then create new virtual environment and install tensorflow using conda install tensorflow refer tensorflow documentaion

Dhinakaran
  • 105
  • 3
  • 14
0

This GitHub issue clears it up, stating that you need to install C++ Redist.

Bram Vanroy
  • 27,032
  • 24
  • 137
  • 239
0
  1. (Clean?) Install Anaconda
  2. Using Anaconda's Navigator, create a new environment (I call it Tensorflow).
  3. In this new environment, search for and install Tensorflow gpu. (This will install package dependencies.)

That should be it.

Community
  • 1
  • 1
PaoloTCS
  • 21
  • 5