No Module Named '_pywrap_tensorflow_internal' - python

While trying to validate the installation of tensorflow-gpu, I get an ImportError when trying to execute "import tensorflow as tf". I am using a Quadro K620 on Windows 7. Tensorflow was installed using pip.
The following is the stack trace:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\aagarwal>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel
per
return importlib.import_module(mname)
File "C:\Users\aagarwal\AppData\Local\Programs\Python\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel
per
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel
per
return importlib.import_module(mname)
File "C:\Users\aagarwal\AppData\Local\Programs\Python\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag
es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel
per
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_
_init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>>
I have looked at multiple other stack overflow posts which things like correcting the path but I have not been able to solve this issue.

I came across the same issue today, please switch to cuDNN v5.1 Library for Windows instead as #mickdelaney suggested and then try to
Check environment settings of CUDA, normally all the settings of CUDA had been added to Windows environment
Copy files in bin, lib and include of cuDNN to bin, lib and include of CUDA respectively. Normally the directory is C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
And then you can import tensorflow and run your code. Good luck!

I found the solution for the CPU: It worked for me
Just run below command if necessary then update it
pip install tensorflow==1.5

you could uninstall the current version of tensorflow and try a low version such as TensorFlow 0.12 using the code
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
https://blog.csdn.net/baidu_36669549/article/details/79734590

After you install the CUDA Drivers you must download cuDNN and release it. After that you get to copy the cudnn64_5.dll to PATH.
If that doesn't work, move the cudnn64_5.dll to
NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin and try it again. Otherwise you'd meet some error that you see.

https://github.com/tensorflow/tensorflow/issues/7705
switch to cuDNN 5.1 instead of 6.0

I had the same error with anaconda, it was previously installed with another program through anaconda. Installing again through conda-forge worked: conda install -c conda-forge tensorflow

I still got this error after installing cuDNN 5.1 (yes, I had PATH set correctly). I had better luck installing tensorflow_gpu from this site. This requires cuDNN 6.0, not 5.1. Unfortunately they currently only have Tensorflow 1.1 for GPU systems.

this is all about your video chip/card and CPU compatibility with TF VERSION! Current version of Tensor Flow is 1.8 and it crashes on both my machines.
I have a win7 Gateway notebook using an I5 CPU and intel video chip. I have a desktop win7 unit with AMD Phenom II and AMD Radeon HD5450 video card. The I5 notebook requires V1.6 of TensorFlow and the desktop AMD unit takes V1.5. I don't have a GPU available for running ANN's so I don't know how that would affect it.
Here's the command line for PIP install: pip install --upgrade tensorflow==1.5.0 (or whatever other version you need). This will uninstall your current version and then install the indicated version.
Build or copy a small TensorFlow script and run it in a command window. Open a second command window and install a different version. I'd recommend starting at 1.5 and working your way up.

The only thing that worked for me (Windows 10) is:
Install Microsoft Visual C++ 2015 Redistributable Update 3
If you have a new fresh computer setup this one might miss.

I am a chinese, so my english is poor, and my answer is that however you use cudnn 7 or 6 or 5 , you must rename the dll from cudnn64_x.dll to cudnn64_6.dll after you copy files.
maybe soon, you need to rename the dll to 7 or 8 or 9 as possible.

It worked for me after doing this command :
pip install tensorflow-gpu == 1.15.5
I was previously with tensorflow-gpu 1.15.0 when it was showing the error

Related

Cannot import bloomberg api

I have installed the bloomberg Python API and set the BLPAPI_ROOT to the VC++ folder.
However, when I import blpapi, I got the following error.
How to get rid of these errors?
Thank you very much.
import blpapi
Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python36\site-packages\blpapi\internals.py", line 39, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\WinPython-64bit-3.6.2.0Qt5\python-3.6.2.amd64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
File "<frozen importlib._bootstrap>", line 560, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python36\site-packages\blpapi\__init__.py", line 4, in <module>
from .internals import CorrelationId
File "C:\Users\user\AppData\Roaming\Python\Python36\site-packages\blpapi\internals.py", line 42, in <module>
_internals = swig_import_helper()
File "C:\Users\user\AppData\Roaming\Python\Python36\site-packages\blpapi\internals.py", line 41, in swig_import_helper
return importlib.import_module('_internals')
File "C:\Program Files\WinPython-64bit-3.6.2.0Qt5\python-3.6.2.amd64\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_internals'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Roaming\Python\Python36\site-packages\blpapi\__init__.py", line 9, in <module>
raise debug_load_error(error)
ImportError: No module named '_versionhelper'
Could not open the C++ SDK library.
Download and install the latest C++ SDK from:
http://www.bloomberg.com/professional/api-library
If the C++ SDK is already installed, please ensure that the path to the library
was added to PATH before entering the interpreter.
I did 2 things to solve an issue similar to that:
1- I installed Microsoft Visual Studio with the following components
C++/CLI Support
VC++ 2015.3 v14.00 (v140) toolset for desktop
Visual C++ MFC for x86 and x64
Visual C++ ATL for x86 and x64
2- I manually copied the .dll files in C++API\lib (blpapi3_32.dll and blpapi3_64.dll in my case) into C:\windows\system32 where all the dll files that system uses.
Also, I copied the dll files in in C++API\lib into C:\blp\DAPI, replacing the new ones with the old ones.
Please set BLPAPI_ROOT environment variable to the location where the blpapi C++ SDK is located.
An alternative option is to use conda, as discussed here and here.
If you use conda you don't need to worry about downloading the C++ SDK and properly configuring the BLPAPI_ROOT. From the conda-forge channel this can be done using
conda install -c conda-forge blpapi

Difficulty in getting Tensorflow to work [duplicate]

I recently started getting into Tensorflow, but i'm having issues with the install. Everytime I try to import it I get the following error
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\[user]\AppData\Local\Programs\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 "<stdin>", line 1, in <module>
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
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 "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\[user]\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\[user]\AppData\Local\Programs\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.
I looked at other stack overflow posts that were having the same problem as me, and they suggested getting the CUDA libraries from NVIDIA. The problem is, I have neither a NVIDIA graphics card nor the GPU version of tensorflow, so I don't think that's the issue. There were also suggestions to make sure the Microsoft redistributables for visual studio are installed, which they are.
If this is a system variable based problem, I'd appreciate help with changing system variables as I'm new to doing that. Thank you!
Some System Info:
OS: Microsoft Windows 10 Pro Version 10.0.17134
CPU: Intel Xeon E5620
Graphics Card: Radeon RX 480
Python Version: 3.6.5 amd64 Tensorflow
Install method: pip install tensorflow
#user1735003 figured it out.
I unistalled the latest version of tensorflow
pip uninstall tensorflow
and then installed tensorflow 1.5
pip install tensorflow==1.5
then I verified the installation worked with the script
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
I got the correct output
Hello, TensorFlow!
My guess is that you are trying to use TF >= 1.6, because your CPU is rather old and does not support AVX instructions. Indeed from 1.6 on, tensorflow pre-built binaries use AVX instructions.
Currently your options are either to:
Use an official pre-built binary of TF 1.5 or earlier. (You will miss a few things but it's still OK I would say).
Search for an unofficial pre-built binary of TF >= 1.6 that does not support AVX.
Currently, pre-built binaries until TF 1.10 from conda install on Windows seem not to be built with AVX support, although I could not find this information anywhere and therefore cannot tell if this is intentional and how long that will be the case.
Beware that binaries from conda-forge (which used to be the main conda tensorflow provider before it has been available on the main channel) on the other hand are built with AVX support.
Change your hardware to support AVX (obviously).
Compile your own binary of tensorflow without AVX instructions. A reasonable option if none of the others were possible.
Have in mind that the above answers are correct for a lot of cases.
However, downgrading to tensorflow 1.5 might not be the best solution because for instance, you won't have access to some of the new features of tensorflow like the 'eager execution' feature for example.
What i did in my case was to install tensorflow 1.8 with conda instead of pip. From my little experience with conda and pip, conda seems to perform better when it comes to placing required files in their proper location.
In summary,
Instead of pip3 install --upgrade tensorflow,
i used conda install tensorflow which will install the latest version properly.
In case you don't have Anaconda installed for conda commands. Download from here
If the problem persists check the version numbering and make sure cuda and TF are compatible.
Check the version numbering here
or for a simpler way, use Anaconda
conda create --name new_env_name tensorflow-gpu
activate new_env_name
I successfully installed TensorFlow GPU version 1.12 (latest until the date of writing) with Cuda 9.0, GeForce 1050 Ti, Windows 10 and Python 3.6.7
Note: You have installed the CUDA Toolkit (version 9) for TensorFlow to recognize your GPU

python tensorflow import dll load failed

I installed latest python 3.6.4 x64 version
and then installed tensorflow for cpu-only with pip3
C:\>pip3 install tensorflow
however when I tried to import tensorflow in python
it showed me the error below
I am sure that I have installed Microsoft Visual C++ 2015 Redistributable(x64)
so it wll not be the problem of dll msvcp140.dll lost
it say that "DLL load failed with error code -1073741795"
so what is exactly the problem here
i cannot find any other information about this error code
my os : windows 7 enterprise with service pack 1 / 64 bit / intel core i5 M 540
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\importlib\__ini
t__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", 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:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\importlib\__ini
t__.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 "<stdin>", line 1, in <module>
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\importlib\__ini
t__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", 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:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\site-packages\t
ensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Alan\AppData\Local\Programs\Python\Python36\lib\importlib\__ini
t__.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_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I got same problem with tensorflow1.6-CPU on win7 64bit(Intel Core 2 Duo Cpu T6670 2.2GHz)
After I found this, and it solved my problem.
Reference this issue: https://github.com/tensorflow/tensorflow/issues/17386
Re-installed by this tensorflow-1.6.0-cp36-cp36m-win_amd64.whl: https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.6.0/py36/CPU/sse2
Hope this .whl may help you.
I faced the same issue with tensorflow-1.12.0
what i did was :
Install anaconda
open anaconda prompt
conda create -n tfp python=3.6
activate tfp
conda install tensorflow
python
Now check by importing tensorflow
the version i used was 3.6, but you can also try with 3.7
Hope it helps!
I downgraded tensorflow to 1.10.0 and it fixed the issue
Probably, your CPU does not have the instructions for AVX (needed for all tensorflow binaries since 1.6). You can check that with some tool like CPU-Z. If that is the case, you can donwload the correct wheel here (use SSE2 binaries):
tensorflow-windows-wheel
I had the same issue.
I upgraded pip version with:
python -m pip install --upgrade pip
also, downgraded with
pip install tensorflow==2.0
and it worked
ImportError: DLL load failed
for
windows 10
python 3.6
pip install protobuf==3.6.0
or
pip3 install protobuf==3.6.0
I fixed it.
Spend days searching to fix them.
Installed tensorflow with pip install tensorflow-cpu
Updated visual C++ 2015-2019
The issue was because I didn't have nvidia graphics so that I should install with cpu version because I am using Radeon Vega 8 graphics.
Hope it helps.
I have tried different methods still it doesn't work then I apply this method it works for me.
STOP you antivirus protection software for half hour then install anaconda,it works fine. 100%
If you use python 3.6.10 and tensorflow 2.1.0
Just follow this -
pip install tensorflow==2.0
It worked for me.
I had first Upgraded the Anaconda prompt
I had then used conda create -n tfp python=3.7
conda activate tfp
Then import the tensorflow
I faced the similar issue for tensorflow 2.0
First I uninstalled tensorflow using pip uninstall tensorflow (no need to uninstall tensorflow-estimator or tensorboard).
Then I reinstall using conda install tensorflow.
Never install the latest version of tensorflow it will raise an error
DLL file load error
pip install tensorflow
never run command on your computer as it not supports the tensorflow cpu
most of the latest version supports mostly gpu
so while installing install the lower version of the tensorflow
from my opininon the stable release of tensorflow is tensorflow 1.5
make sure you uninstalled your tensorflow installed in your computer
pip uninstall tensorflow
After above step shutdown your pc and restart.Then only install tensorflow 1.5
command to install tensorflow version 1.5
pip install tensorflow==1.5
Install Microsoft Visual C++ 2019 Redistributable & reboot the PC, it will work with tensorflow 2.3.1 in python 3.7

Installing Tensorflow GPU on Win 8 :

I am trying to install Tensorflow gpu (for Keras) with Anaconda 4.2 for days.
My last attempt was following this tutorial : https://sites.google.com/site/ivanhuertacasado/installing-keras-theano-tensorflow-with-gpu-windows
I don't intend to use theano, only tensorflow-gpu.
My specs are the following :
Windows 8.1, 64 bits
Geforce GTX 860M (for notebook)
I tried all version of Cudnn, from 5 to 7 with Cuda 8 and 9 (almost).
All the time, I get the same error when I try "import tensorflow", as you can find here :
Using TensorFlow backend.
Traceback (most recent call last):
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "E:\Users\user\Anaconda3\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Le module spécifié est introuvable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "E:\Users\user\Anaconda3\lib\importlib\__init__.py", line 126, in import_
module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "cifar10_cnn.py", line 11, in <module>
import keras
File "E:\Users\user\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in
<module>
from . import utils
File "E:\Users\user\Anaconda3\lib\site-packages\keras\utils\__init__.py", line
6, in <module>
from . import conv_utils
File "E:\Users\user\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", li
ne 3, in <module>
from .. import backend as K
File "E:\Users\user\Anaconda3\lib\site-packages\keras\backend\__init__.py", li
ne 83, in <module>
from .tensorflow_backend import *
File "E:\Users\user\Anaconda3\lib\site-packages\keras\backend\tensorflow_backe
nd.py", line 1, in <module>
import tensorflow as tf
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\__init__.py", line
24, in <module>
from tensorflow.python import *
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\__init__.py"
, line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "E:\Users\user\Anaconda3\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Le module spécifié est introuvable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "E:\Users\user\Anaconda3\lib\importlib\__init__.py", line 126, in import_
module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
The Cpu test works well, but can't find how to work with the gpu.
I have been searching and here is the list of what I can say I tried :
Checking System32, if there is MSVCP140.DLL. There is the Dll. I cannot install VC++ redistribuable 2015 since there is already the 2017 version on my computer. And I uninstalled/installed it again to check.
I set %CUDA_HOME% as C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA
I set %CUDA_PATH% as C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
I added the .DLL extension to the %PATH_EXT%
%PATH% targets to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
All the time, I move the Cudnn to their respective Cuda folder (bin/includes/...)
In the CMD, cudnn64_5.dll is found correctly (no matter in which directory I am, the cmd finds it).
My GeForce Game Ready Driver is up to date
I was not able to get the GPU working with Theano
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return st
atus', 255, 'for cmd', 'nvcc -shared -O3 --compiler-bindir E:\Program Files (x8
6)\Microsoft Visual Studio\2017\Community\VC -Xlinker /DEBUG -D HAVE_ROUND -
m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEP
RECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -I"E:\Users\user\Anaconda3\lib\site
-packages\theano\sandbox\cuda" -I"E:\Users\user\Anaconda3\lib\site-packa
ges\numpy\core\include" -I"E:\Users\user\Anaconda3\include" -I"E:\Users\
\user\Anaconda3\lib\site-packages\theano\gof" -L"E:\Users\user\Anaconda3
\libs" -L"E:\Users\user\Anaconda3" -o C:\Users\user\AppData\Local\Thean
o\compiledir_Windows-8.1-6.3.9600-SP0-Intel64_Family_6_Model_60_Stepping_3_Genu
ineIntel-3.5.2-64\cuda_ndarray\cuda_ndarray.pyd mod.cu -lcublas -lpython35 -lc
udart')
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be remove
d in the next release (v0.10). Please switch to the gpuarray backend. You can g
et more information about how to switch at this URL:
https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpua
rray%29
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not availabl
e (error: cuda unavailable)
forrtl: error (200): program aborting due to control-C event
Image PC Routine Line Source
libifcoremd.dll 00007FFA853843E4 Unknown Unknown Unknown
KERNELBASE.dll 00007FFAB27CD37F Unknown Unknown Unknown
KERNEL32.DLL 00007FFAB44413D2 Unknown Unknown Unknown
ntdll.dll 00007FFAB54854E4 Unknown Unknown Unknown
Cuda works properly in the Sample provided by nvidia
Nvcc --version returns the following :
C:\Users\user>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Mon_Jan__9_17:32:33_CST_2017
Cuda compilation tools, release 8.0, V8.0.60
Has anybody any idea ?
Ok, so I could fix the issue.
The problem came from Visual Studio 2017.
I uninstalled all version of Cuda (and the CDNN).
I uninstalled VS 2017 and all redistrib data
I installed VS 2015 :
I installed Cuda 8.0
I installed in the cuda folder the CuDnn 5.1, then the CuDnn 6.0 (I replaced when necessary)
Thus, my problem was fixed. Hope it my help any people.

Failed to load the native TensorFlow runtime. Python 3.5.2

I'm trying to install Tensorflow in my PC, i installed Python 3.5.2 64-bit, cuda_8.0.61 for windows 10 and cudnn-8.0-windows10-x64-v6.0
I used "native" pip to install GPU version of Tensorflow, then i open IDLE and testing with "import tensorflow as tf" and i got the error bellow
How can i fix this ? Thanks you in advance <3
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Admin\AppData\Local\Programs\Python\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import tensorflow as tf
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Admin\AppData\Local\Programs\Python\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 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: 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.
I managed to run Tensorflow on Windows following these steps. Hope it helps! It may change depending in which folder you installed Python.
Download and install Python 3.5.x
Download and install Nvidia CUDA Toolkit
Download CuDNN 5.1
Copy CuDNN files to Nvidia CUDA toolkit folder when 2. has completed (usually is located on C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0)
copy cudnn\bin\cudnn64_5.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\
copy cudnn\include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include\
copy cudnn\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64\
Install Tensorflow via pip command prompt
'pip install --upgrade tensorflow-gpu'
5.1 TensorFlow dependencies
make sure that Visual C++ Redistributate 2015 x64 is installed. If not, download it
move _curses_curses.cp35-win_amd64.pyd and _curses_panel.cp35-win_amd64.pyd to
C:\Users\Username\AppData\Local\Programs\Python\Python35\Lib\site-packages (or you may need to download them as the next packages. just Ctrl+f for 'curses')
download and install these packages via pip (move to the directory where they were
downloaded, open a command prompt and make 'pip install package_name')
numpy+mkl (http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
download numpy‑1.12.1+mkl‑cp35‑cp35m‑win_amd64.whl
pip install numpy‑1.12.1+mkl‑cp35‑cp35m‑win_amd64.whl
scipy (http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy)
download scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
pip install scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
open command prompt and make 'pip install matplotlib'
Try:
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
to install tensorflow instead of:
pip install --upgrade tensorflow-gpu
My computer is Windows with CPU and I have had same issues. I uninstall tensorflow 1.9 and install 1.5 instead. It works right now.
Why don't try Anaconda?
conda create -n gpu_env tensorflow-gpu
conda activate gpu_env
As easy as that. All the packages and runtime needed (Visual Studio included) will be brought together while you watch in awe :). Give it a try!
Caveat: You need to run Keras from inside tensorflow in order for it to detect and use your GPU. Otherwise if you use just keras and tensorflow as a backend, Keras will use plain tensorflow and not tensorflow-gpu. Boths are installed side by side.
Meaning you should code it this way:
import tensorflow as tf
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import Dense,Dropout
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping,CSVLogger
from tensorflow.keras.utils import plot_model
.............
.............
Hope this help.
If the problem persists check the version numbering and make sure cuda and TF are compatible.
Check the version numbering here
or for a simpler way, use Anaconda
conda create --name new_env_name tensorflow-gpu
activate new_env_name
I successfully installed TensorFlow GPU version 1.12 (latest until the date of writing) with Cuda 9.0, GeForce 1050 Ti, Windows 10 and Python 3.6.7
Note: You have installed the CUDA Toolkit (version 9) for TensorFlow to recognize your GPU
The problem for me was with a package named protobuf, It was solved by using
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
which upgraded protobuf to 3.6.1 and solved the error.
I have the same problem with you.
The problem is that Anaconda automatically updates the python version when installing ipython and spyder, which becomes version 3.6.
You can change the python version to version 3.5 by entering the tensorflow environment via Anaconda.
enter image description here
Everything could be installed from the console:
conda create --name tf-gpu
conda install -c aaronzs tensorflow-gpu
conda install -c anaconda cudatoolkit
conda install -c anaconda cudnn
conda install keras-gpu
Let’s solve this issue in a simplified way…
I do hope that you are going through some problems when trying to import TensorFlow or maybe when importing other libraries which use TensorFlow in the backend.
I solved the above problem by installing Visual C++ distribution.
Click to download visual C++ version.
Now, It ran successfully.

Categories