not_yet_a_fds
not_yet_a_fds

Reputation: 316

Working on Tensorflow :: ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

I am stuck since hours but the issue is still not resolved.

I am using only the CPU version and getting the same No module named 'pywrap_tensorflow_internal' error ::

Traceback (most recent call last): File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname)

File "C:\Python\Python36\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)

File "", line 994, in _gcd_import

File "", line 971, in _find_and_load

File "", line 955, in _find_and_load_unlocked

File "", line 658, in _load_unlocked

File "", line 571, in module_from_spec

File "", line 922, in create_module

File "", line 219, in _call_with_frames_removed

ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import *

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper return importlib.import_module('pywrap_tensorflow_internal')

File "C:\Python\Python36\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 1, in import tensorflow

File "C:\Python\Python36\lib\site-packages\tensorflow_init_.py", line 24, in from tensorflow.python import *

File "C:\Python\Python36\lib\site-packages\tensorflow\python_init_.py", line 49, in from tensorflow.python import pywrap_tensorflow

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg)

ImportError: Traceback (most recent call last):

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname)

File "C:\Python\Python36\lib\importlib_init_.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level)

File "", line 994, in _gcd_import

File "", line 971, in _find_and_load

File "", line 955, in _find_and_load_unlocked

File "", line 658, in _load_unlocked

File "", line 571, in module_from_spec

File "", line 922, in create_module

File "", line 219, in _call_with_frames_removed

ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import *

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in _pywrap_tensorflow_internal = swig_import_helper()

File "C:\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper return importlib.import_module('pywrap_tensorflow_internal')

File "C:\Python\Python36\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

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

Checked the previous solutions that have been mentioned on StackOverflow and Github and based on those made the following changes:-

**1. I have placed msvcp140.dll in system32(64-bit file) and SysWOW64(32-bit file) as advised in https://www.youtube.com/watch?v=61vwFxnnh5c

  1. I have also downloaded and installed Microsoft Visual C++ 2015 Redistributable Update 3

  2. On running the selfcheck.py, I am getting the following result:: ERROR: Failed to import the TensorFlow module.**

WARNING! This script is no longer maintained! Since TensorFlow 1.4, the self-check has been integrated with TensorFlow itself, and any missing DLLs will be reported when you execute the import tensorflow statement. The error messages printed below refer to TensorFlow 1.3 and earlier, and are inaccurate for later versions of TensorFlow.

Python version is 3.6.

TensorFlow is installed at: C:\Python\Python36\lib\site-packages\tensorflow

Could not load 'cudart64_80.dll'. The GPU version of TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

Could not load 'nvcuda.dll'. The GPU version of TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Typically it is installed in 'C:\Windows\System32'. If it is not present, ensure that you have a CUDA-capable GPU with the correct driver installed.

Could not load 'cudnn64_5.dll'. The GPU version of TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and it is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 5.1 from this URL: https://developer.nvidia.com/cudnn

Could not find cuDNN.

Please Help

Upvotes: 3

Views: 5547

Answers (1)

Sajjad Manal
Sajjad Manal

Reputation: 391

I encountered the same issue and the problem was with the version of TensorFlow. Follow the below steps in order to remedy this situation:

  1. Open the terminal via Anaconda navigator.
  2. Run the command: conda install tensorflow
  3. Try working with your code again and it will just work fine.

Upvotes: 1

Related Questions