Unable to import tensorflow - Failed to load native tensorflow runtime

Pragyaditya Das

I have been using tensorflow for quite sometime now via Anaconda. Today, my computer crashed and I had to reinstall Anaconda again, post installation of tensorflow today, each time I try to import it, I get the following error -

(base) C:\Users\Pragyaditya Das>python
Python 3.7.6 (default, Jan  8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as t
Traceback (most recent call last):
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
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 "<stdin>", line 1, in <module>
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Pragyaditya Das\anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Pragyaditya Das\anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

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

When I do pip freeze | findstr tensorflow, I get the following details - tensorflow==2.1.0 tensorflow-estimator==2.1.0

I went through various answers here and in the github repo of tensorflow but in vain.

Any kind help is appreciated in advance.

Pragyaditya Das

While I was waiting for a reply, I was able to solve the error on my own. The step-by-step guide is as follows:

  1. Install VS 2017, tensorflow doesn't use it but having it helps in the smooth installation of CUDA toolkit.
  2. Update NVDIA driver from windows device manager.
  3. Download and Install CUDA toolkit (version 10.1).
  4. Download and unzip CUDnn 7.6.5. Copy the extracted files into a folder in C drive.
  5. Add ~\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin, ~\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin and cudnn-10.1-windows10-x64-v7.6.4.38\cuda\bin to PATH

Doing import tensorflow as tf after the above steps solved the issue.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Failed to load the native TensorFlow runtime

From Java

error: Failed to load the native TensorFlow runtime

From Dev

Failed to load the native TensorFlow runtime.?

From Dev

Error : Failed to load the native Tensorflow runtime

From Java

Failed to load the native TensorFlow runtime. Python 3.5.2

From Dev

Django webapplication Failed to load the native TensorFlow runtime. in Heroku

From Dev

ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'. Failed to load the native TensorFlow runtime

From Dev

python tensorflow import dll load failed

From Dev

Failed to load the native TensorFlow runtime. when running g2p-seq2seq --version

From Dev

Failed to load the native TensorFlow runtime. Reason : Image not found. What am I doing wrong?

From Dev

Failed to import Tensorflow in Anaconda

From Dev

Tensorflow (1.13.1) Exception when import: DLL load failed (Windows 10)

From Dev

unable to import tensorflow on pycharm

From Dev

Unable to load tensorflow in Django

From Dev

Tensorflow-GPU unable to import

From Dev

Failed to load the TensorFlow runtime; `Library not loaded: @rpath/libcudnn.5.dylib`

From Dev

ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

From Dev

"ImportError: DLL load failed" when importing tensorflow

From Dev

Unable to import Tensorflow "No module named copyreg"

From Dev

Unable to import tensorflow in python: "no module named tools"

From Dev

Getting the error "DLL load failed: The specified module could not be found." while trying to import tensorflow for Windows in Anaconda using PyCharm

From Java

ImportError: Failed to import any qt binding, Python - Tensorflow

From Dev

Import tensorflow failed with Error no attribute 'HIDDEN_ATTRIBUTE'

From Dev

Tensorflow installation issue: ImportError: DLL load failed with error code -1073741795

From Java

Tensorflow error : DLL load failed: The specified procedure could not be found

From Dev

DLL load failed when importing TensorFlow with GPU support

From Dev

Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

From Dev

Tensorflow: ImportError: DLL load failed: Cannot find module

From Dev

unable to import Metric from tensorflow.keras.metrics

Related Related

  1. 1

    Failed to load the native TensorFlow runtime

  2. 2

    error: Failed to load the native TensorFlow runtime

  3. 3

    Failed to load the native TensorFlow runtime.?

  4. 4

    Error : Failed to load the native Tensorflow runtime

  5. 5

    Failed to load the native TensorFlow runtime. Python 3.5.2

  6. 6

    Django webapplication Failed to load the native TensorFlow runtime. in Heroku

  7. 7

    ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'. Failed to load the native TensorFlow runtime

  8. 8

    python tensorflow import dll load failed

  9. 9

    Failed to load the native TensorFlow runtime. when running g2p-seq2seq --version

  10. 10

    Failed to load the native TensorFlow runtime. Reason : Image not found. What am I doing wrong?

  11. 11

    Failed to import Tensorflow in Anaconda

  12. 12

    Tensorflow (1.13.1) Exception when import: DLL load failed (Windows 10)

  13. 13

    unable to import tensorflow on pycharm

  14. 14

    Unable to load tensorflow in Django

  15. 15

    Tensorflow-GPU unable to import

  16. 16

    Failed to load the TensorFlow runtime; `Library not loaded: @rpath/libcudnn.5.dylib`

  17. 17

    ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

  18. 18

    "ImportError: DLL load failed" when importing tensorflow

  19. 19

    Unable to import Tensorflow "No module named copyreg"

  20. 20

    Unable to import tensorflow in python: "no module named tools"

  21. 21

    Getting the error "DLL load failed: The specified module could not be found." while trying to import tensorflow for Windows in Anaconda using PyCharm

  22. 22

    ImportError: Failed to import any qt binding, Python - Tensorflow

  23. 23

    Import tensorflow failed with Error no attribute 'HIDDEN_ATTRIBUTE'

  24. 24

    Tensorflow installation issue: ImportError: DLL load failed with error code -1073741795

  25. 25

    Tensorflow error : DLL load failed: The specified procedure could not be found

  26. 26

    DLL load failed when importing TensorFlow with GPU support

  27. 27

    Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

  28. 28

    Tensorflow: ImportError: DLL load failed: Cannot find module

  29. 29

    unable to import Metric from tensorflow.keras.metrics

HotTag

Archive