Installing Tensorflow GPU on Win 8 : - python

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.

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

Tensorflow 1.7.1 error with python 3.5

I install tensorflow 1.7.1 to use with Unity ML-Agent. I install tensorflow with the following command:
pip3 install tensorflow==1.7.1
Installation goes fines but when I try to import tensorflow I got this error:
C:\>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Python35_x64\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 903, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Une routine d\u2019initialisation d\u2019une bibliothèque de liens dynamiques (DLL) a échoué.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python35_x64\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:\Python35_x64\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Python35_x64\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Python35_x64\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 903, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Une routine d\u2019initialisation d\u2019une bibliothèque de liens dynamiques (DLL) a échoué.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python35_x64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python35_x64\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.
>>>
Microsoft C++ 2015 redistributable as installed on my system and I find MSVCP140.dll easily with the dos command ( like suggested in common installation issue docs ):
C:\>where MSVCP140.dll
C:\Windows\System32\msvcp140.dll
I don't install CUDA and cuDNN things because I don't have cuda cards and I only install tensorflow for CPU like suggested.
EDIT: Downgrading to TensorFlow 1.5 is not a solution for me because Unity ML-agents really need 1.7.1
Finally it's a AVX support problem.
My CPU don't support AVX instructions.
I compile myself the TensorFlow 1.7.1 from sources. Finally not that hard as I think ( but take few hours on my poor laptop). With GIT , CMAKE , SWIG and Python 3.5 I fellow the instruction on the tensorflow github repo ( readme.md ):
https://github.com/tensorflow/tensorflow/tree/v1.7.1/tensorflow/contrib/cmake
Everything goes fine except few " out of heap space " errors. Trying to add the flags /Zm200 , /Zm500 or anything else not working for me. I solve this issue by forcing to use 64bit VC compiler:
https://github.com/tensorflow/tensorflow/issues/11096
On this issue page , the user kalengi suggest some tips. I only use his commands for MSBuild:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MSBuild.exe" /m:2 /p:CL_MPCount=1 /p:Configuration=Release /p:Platform=x64 /p:PreferredToolArchitecture=x64 ALL_BUILD.vcxproj
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MSBuild.exe" /m:2 /p:CL_MPCount=1 /p:Configuration=Release /p:Platform=x64 /p:PreferredToolArchitecture=x64 tf_python_build_pip_package.vcxproj

Tensorflow on Windows (DLL load failed and ModuleNotFoundError)

I am trying to install tensorflow (GPU) on Windows 10. I followed the instructions on https://www.tensorflow.org/install/install_windows.
During the installation process I have not noticed any issues but when I try to import tensorflow I get this error:
import tensorflow as tf
Traceback (most recent call last):
File "<ipython-input-2-41389fad42b5>", line 1, in <module>
import tensorflow as tf
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\ProgramData\Anaconda3\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 module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\ProgramData\Anaconda3\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 am very new to this so any answers are appreciated.
Thanks in advance.
Edit: After some research I tried a couple of things so I think I should mention them. Firstly, I have installed Microsoft Visual C++ 2015 Redistributable (Update 3). After this I re-installed CUDA toolkit 8.0 and cuDNN. I also checked the version of cuDNN which is v5.1 and I think is correct. I also tried to pip install tensorflow-gpu but the issue is still not resolved. I have also tried the CPU version which works without any issue.
Edit 2: Ok so I managed to resolve the issue by using the cuDNN v6.0 despite what it says in the tensorflow website. I think it works now but I am not sure. I managed to run the 'Hello Tensorflow' example so I think it is ok now.
If anyone knows why this solution works I would appreciate the explanation.

Unable to run import tensorflow as tf

I installed tensorflow using the following command.
pip install tensorflow
I am running a simple program which is
import tensorflow as tf
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0) # also tf.float32 implicitly
print(node1, node2)
I am getting the following error on running the program.
Traceback (most recent call last):
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files (x86)\Python\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:\Program Files (x86)\Python\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files (x86)\Python\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 "first.py", line 1, in <module>
import tensorflow as tf
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files (x86)\Python\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:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files (x86)\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files (x86)\Python\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 have updated the pip and am running the program on python 3.5
This error message typically means that one of TensorFlow's dependencies cannot be found on your system. Since you are using the CPU-only version of TensorFlow on Windows, the most likely missing DLL is msvcp140.dll, which is required to run programs compiled using Microsoft Visual C++ 2015. This DLL is usually installed on developer machines as part of Visual Studio, or some Python distributions like Anaconda. However, the Python.org distribution of Python for Windows does not include it.
You can install msvcp140.dll on your system by downloading and installing the Microsoft Visual C++ 2015 Redistributable Update 3.
For others who find this answer, note that this script can help to diagnose common TensorFlow on Windows installation issues.
I'm not exactly sure what the problem is, and probably as clueless as you about the error message, but as you are using python 3.x, shouldn't you have installed tensorflow by using:
pip3 install tensorflow
To see if you are using pip3 type:
pip3 -V
If you need more help, visit the official tutorial for mac or linux.
I hope this helps
dan4o

Tensorflow-GPU Error - Pycharm

I am installing Tensor flow.
I was having trouble installing through Anaconda, so I uninstalled everything including Python, and downloaded Python 3.5 from here:
https://www.python.org/downloads/release/python-352/
After installing Python 3.5 I installed PyCharm, and set my path variables so that it could find the Python folder.
Then I used command prompt to install tensorflow using:
pip3 install --upgrade tensorflow-gpu
Anyway, it installed tensorflow and the other stuff like numpy, protobuf, etc
I set up a project in PyCharm and set the interpreter to the default one located in the Python35 folder.
I opened up the Python console within Pycharm and typed:
import tensorflow
to get this error:
import tensorflow
Traceback (most recent call last):
File "C:\Users\Justin\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\Justin\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\Justin\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:\Program Files\JetBrains\PyCharm Community Edition 2017.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Justin\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\Justin\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\Justin\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 "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Justin\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
Failed to load the native TensorFlow runtime.
I hope that is enough detail for someone to help me.
You are missing some dependencies. I would recommend to rebuild it from scratch. Use this guide for Windows.
You need to fulfill the requirements for running TF GPU.

Categories