Skip to content

ImportError: No module named '_pywrap_tensorflow' Failed to load the native TensorFlow runtime. #8385

Closed
@WahabZia

Description

@WahabZia

Apologies for the inappropriate description i am actually very new to Machine learning my

TF version is 1.0.1
Python version is 3.5.2
OS windows 8 64bit and
Native pip
as recommended on tensor flow.org
https://www.python.org/downloads/release/python-352/

The problem ocured at this simple import command

import tensorflow as tf

What other attempted solutions have you tried?

None

Logs or other output that would be helpful

(If logs are large, please upload as attachment or provide link).

C:\Users\test\Desktop>>python firstp.py
Traceback (most recent call last):
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_ini
t
_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", 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\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 21, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow')
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_ini
t
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\test\Desktop\firstp.py", line 1, in
import tensorflow as tf
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python_init_.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_ini
t
_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", 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\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 21, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\site-packages\t
ensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow')
File "C:\Users\test\AppData\Local\Programs\Python\Python35\lib\importlib_ini
t
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_st
arted/os_setup.md#import_error

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

Activity

MicaelCarvalho

MicaelCarvalho commented on Mar 14, 2017

@MicaelCarvalho
Contributor

Please fill the template for new issues, with information about OS, TF version, python version etc. It is very hard to diagnose a problem without the information required on the template (made to be filled, not erased). And check your installation of tensorflow, these errors look like a bad installation.

Carmezim

Carmezim commented on Mar 15, 2017

@Carmezim
Contributor

@WahabZia Sorry you faced issues trying to run TF. If you installed for GPU support I need you to:

  1. Check if your %CUDA_HOME% is properly set and CUDA and cuDNN DLLs directories are in your PATH.
  2. After that if the issue persists install the Visual C++ Redistributable 2015 x64 as MSVCP140.DLL may be missing in your system.

Thanks for filling the issue and feel free to ask any questions or doubts you may still have about TensorFlow.

WahabZia

WahabZia commented on Mar 15, 2017

@WahabZia
Author

Thanks @Carmezim for your kind reply i am using the CPU-only version of TensorFlow . What should i do

Carmezim

Carmezim commented on Mar 15, 2017

@Carmezim
Contributor

@WahabZia If you are using Python.org distribution and receiving this error is very likely MSVCP140.DLL is not installed in your system.
So as I provided on step 2, please try installing Visual C++ Redistributable linked above, uninstall then install TF again and let us know if you had progress on it.

WahabZia

WahabZia commented on Mar 15, 2017

@WahabZia
Author

Thanks @Carmezim for the help i have found the dll from the DLLFiles.com
https://www.dll-files.com/msvcp140.dll.html
The import issue is resolved

I also used this command

C:> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_amd64.whl

From this thread
http://stackoverflow.com/questions/42011070/on-windows-running-import-tensorflow-generates-no-module-named-pywrap-tenso

before placing the DLL in System32

And now i am facing this issue when i am sort of trying to validate my installation.

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Windows\system32>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
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') fo
r unknown op: BestSplits
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_t
ype: "CPU"') for unknown op: CountExtremelyRandomStats
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"')
for unknown op: FinishedNodes
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for
unknown op: GrowTree
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_ty
pe: "CPU"') for unknown op: ReinterpretStringToFloat
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"')
for unknown op: SampleInputs
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"'
) for unknown op: ScatterAddNdim
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') fo
r unknown op: TopNInsert
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') fo
r unknown op: TopNRemove
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"
') for unknown op: TreePredictions
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core
\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "C
PU"') for unknown op: UpdateFertileSlots
b'Hello, TensorFlow!'

Thanks alot for the help

WahabZia

WahabZia commented on Mar 15, 2017

@WahabZia
Author

Both of the problems are resolved . Thanks gentelmen for the help . The issue was occurring because of missing MSVCP140.DLL which was found on https://www.dll-files.com/msvcp140.dll.html
or by installing Visual C++ Redistributable as recomeded by fellows .
Thanks @Carmezim and @MicaelCarvalho for the help

imamol555

imamol555 commented on Mar 19, 2017

@imamol555

I am also facing the same problem(2nd one). I have installed Visual C++ Redistributable but still facing this issue. Please help me out.

imamol555

imamol555 commented on Mar 20, 2017

@imamol555

@WahabZia plz help

WahabZia

WahabZia commented on Mar 22, 2017

@WahabZia
Author

Hello @imamol555 sorry for the late reply can you please share the logs . So that i can the reason for the problem . Sorry again for the late reply i didn't check git account for a couple of days .

krishnaputhran

krishnaputhran commented on Mar 26, 2017

@krishnaputhran

@WahabZia plz help. You mentioned that you also faced issue 2nd, but probably forgot to mention how you addressed it. As you requested the logs are as shown below. This is same as you mentioned before

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots
b'Hello, TensorFlow!'

appreciate if you can help to resolve this.

Carmezim

Carmezim commented on Mar 26, 2017

@Carmezim
Contributor

@krishnaputhran If you look up the comments you'll see his issue was due missing the MSVCP140.DLL. You can solve it by downloading the Visual C++ Redistributable.

But some users had this problem after install with pip install tensorflow because of a bug on the wheel and not the missing DLL mentioned. To solve it uninstall TensorFlow, download this nightly build choosing the right version, CPU or GPU, and install with this wheel.

krishnaputhran

krishnaputhran commented on Mar 26, 2017

@krishnaputhran

@Carmezim thanks for your immediate response and I appreciate that. Yes my issue is solved now. I had to do the following as mentioned above.

  1. The "import tensorflow as tf" is solved my installing the Visual C++ Redistributable.. Make sure in your System32 or C:\Windows\SysWOW64 has the msvcp140.dll
  2. To get rid off the second issue as mentioned above, upgrade your Tensorflow to the latest nightly build nightly build. As the fix is not yet promoted to the release and available in the nightly builds.
fuxiang-chen

fuxiang-chen commented on May 18, 2017

@fuxiang-chen

Indeed, pip3 install --upgrade tensorflow-gpu seems to be causing the issue (tested on Win 10), despite installing the Visual C++ Redistributable. Installing via the following command solves the problem: pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_amd64.whl

dwiggles

dwiggles commented on May 29, 2017

@dwiggles

That solved it for me, too. Thanks.

32 remaining items

Carmezim

Carmezim commented on Mar 3, 2018

@Carmezim
Contributor

@narendra-7638 Hi, could you try running this script locally and see what it indicates?
There's clearly a missing or misplaced DLL TensorFlow isn't able to locate in your system so it will help pointing that out.

SanaAnsari-SA

SanaAnsari-SA commented on Mar 29, 2018

@SanaAnsari-SA

Hi @Carmezim and @WahabZia , I m facing the same issue for installing TF for CPU-only version. I guess i don't need to install CUDA for CPU-only version. I tried using the following
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu /tensorflow-1.6.0-cp35-cp35m-win_amd64.whl

But getting the following error

tensorflow-1.6.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

Please help. I have downloaded CUDNN-9.1 but i still feel that i don't need it for CPU-only version, SO haven't installed it yet.
I have the MSVC140.DLL in System32 folder. Also added it in PATH environmental variable.

Also I was working on the previous version of tensorflow i.e 1.5.0 and everything worked fine. This problem started wen I upgraded to the latest version 1.6.0 just to avoid warnings

Python : 3.6.4 installed from python.org for 64bit executable
Tensorflow : 1.6.0 using command "pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.6.0-cp36-cp36m-win_amd64.whl"
System Windows 7 64-bit
Native pip

Please revert asap.. Thanking you in anticipation

here is the trace stack

import tensorflow
Traceback (most recent call last):
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "D:\Software-Installations\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 "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Software-Installations\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 "D:\Software-Installations\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 "<pyshell#0>", line 1, in
import tensorflow
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python_init_.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "D:\Software-Installations\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 "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "D:\Software-Installations\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "D:\Software-Installations\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 "D:\Software-Installations\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.

avi121212

avi121212 commented on Jun 7, 2018

@avi121212

Hi Ive got the same problem and ive tried all the solutions i can find but i still get the same result

D:\Avinaash\Downloads\models-master\models\research>python object_detection/builders/model_builder_test.py
Traceback (most recent call last):
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python_init_.py", line 54, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "object_detection/builders/model_builder_test.py", line 18, in
import tensorflow as tf
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python_init_.py", line 60, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\imp.py", line 296, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python_init_.py", line 54, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Avinaash\AppData\Local\Programs\Python\Python35\lib\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ImportError: No module named '_pywrap_tensorflow'

Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

jayasimhasai

jayasimhasai commented on Jul 22, 2018

@jayasimhasai

Use python3.5 version it solves all the problems. I spent almost weeks on these errors.

hemangjoshi37a

hemangjoshi37a commented on Dec 15, 2018

@hemangjoshi37a

@WahabZia Sorry you faced issues trying to run TF. If you installed for GPU support I need you to:

  1. Check if your %CUDA_HOME% is properly set and CUDA and cuDNN DLLs directories are in your PATH.
  2. After that if the issue persists install the Visual C++ Redistributable 2015 x64 as MSVCP140.DLL may be missing in your system.

Thanks for filling the issue and feel free to ask any questions or doubts you may still have about TensorFlow.

When I try to install using this install it gives me error that

Another versionof this product is already installed. Installation of this version can not continue. To configure ....bla bla bla

Please Help
https://hjlabs.in/

gauravshimpi

gauravshimpi commented on Jan 12, 2019

@gauravshimpi

Hello,

i have the Visual C++ Redistributable 2015 x64 as well as DLL (msvp..) file too....
i am using tensorflow for the first time on windows 10
when i m running the following statement in python
import tensorflow as tf

it gives the following error

import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init_.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python_init_.py", line 66, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Gaurav Shimpi\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

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

Please assist :(

TomMaullin

TomMaullin commented on Jan 20, 2019

@TomMaullin

I have the same issue as @hemangjoshi37a . I seem to have Visual C++ Redistributable 2017 x64 installed. I do not wish to uninstall it but there is no way to install 2015 without uninstalling it as far as I can see. Please advise on what should be done here.

hemangjoshi37a

hemangjoshi37a commented on Feb 8, 2019

@hemangjoshi37a

@TomMaullin okay bro. Thank for the help.
https://hjlabs.in/

nsa-123

nsa-123 commented on Apr 18, 2022

@nsa-123

I am also facing the same error.

python --version gave
Python 3.7.0

Tensorflow version is

(0.12.0)

I have already installed Microsoft Visual C++ Redistribution (x64) 9.0.30729.17/.6161 / .21022 /(x86) 30729.17/ (x86) 30729.6161

Microsoft Visual C++ Redistribution2015-2019 (x64) 14.25.28508
Microsoft Visual C++ Redistribution2015-2019 (x64) 14.31.31103

I have included path to all dlls to environment variable path.

OS is Win 7 Ultimate.

When I do
import tensorflow as tf

I get following error
`---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in swig_import_helper()
17 try:
---> 18 fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
19 except ImportError:

h:\python installed\lib\imp.py in find_module(name, path)
296 else:
--> 297 raise ImportError(_ERR_MSG.format(name), name=name)
298

ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

ModuleNotFoundError Traceback (most recent call last)
h:\python installed\lib\site-packages\tensorflow\python_init_.py in
53 # use dlopen() for dynamic loading.
---> 54 from tensorflow.python import pywrap_tensorflow
55 except ImportError:

h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in
27 return _mod
---> 28 _pywrap_tensorflow = swig_import_helper()
29 del swig_import_helper

h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in swig_import_helper()
19 except ImportError:
---> 20 import _pywrap_tensorflow
21 return _pywrap_tensorflow

ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
----> 1 import tensorflow as tf
2 from tensorflow.keras.utils import to_categorical

h:\python installed\lib\site-packages\tensorflow_init_.py in
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
25 # pylint: enable=wildcard-import
26

h:\python installed\lib\site-packages\tensorflow\python_init_.py in
58 please exit the tensorflow source tree, and relaunch your python interpreter
59 from there.""" % traceback.format_exc()
---> 60 raise ImportError(msg)
61
62 # Protocol buffers

ImportError: Traceback (most recent call last):
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(file)])
File "h:\python installed\lib\imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "h:\python installed\lib\site-packages\tensorflow\python_init_.py", line 54, in
from tensorflow.python import pywrap_tensorflow
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "h:\python installed\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dwiggles@hemangjoshi37a@imamol555@fuxiang-chen@Carmezim

        Issue actions

          ImportError: No module named '_pywrap_tensorflow' Failed to load the native TensorFlow runtime. · Issue #8385 · tensorflow/tensorflow