Importerror dll load failed while importing pywrap tensorflow internal не найден указанный модуль
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!
Thanks, this worked for me. My Anaconda install was version 5.2.0. Installing tensorflow 1.12.0 through the Anaconda Navigator did not work, but doing it your way did. I had to cd to C:\Users\Username\Anaconda3\Scripts for your line 5.
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):
I had the same issue. I upgraded pip version with:
also, downgraded with
ImportError: DLL load failed
for
windows 10
python 3.6
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.
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
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
Describe the problem
I am having a problem as Import error. Here is the stack code.
Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "f:/MACHINE LEARNING/chatbot/main.py", line 9, in
import tensorflow
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python_init.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\HP\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
It happened only after I just imported TensorFlow. Is it because I don't have a graphic card?
Describe the problem
When i import tensorflow like normal it throw an error, i have done the same thing on my laptop and there it all works fine, ik have the exact same code and followed the exact same steps, but on my computer it just fails.
Provide the exact sequence of commands / steps that you executed before running into the problem
- open a python file;
- import tensorflow as tf
- error occurs
Traceback (most recent call last):
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 29, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 25, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "model_main_tf2.py", line 31, in
import tensorflow.compat.v2 as tf
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python_init.py", line 52, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 29, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 25, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\TastDesktop\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow_init_.py", line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python_init.py", line 50, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\linj\AppData\Local\Programs\Python\Python38\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
Failed to load the native TensorFlow runtime.
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I am trying to import tensorflow. but I am getting import error. Please help me rectify the problem. I tried following.
When I execute pip freeze I see the installed tensorflow package with specified version.
Error Message:
3 Answers 3
Use Anaconda to install Tensorflow,
Create separate environment for Tensorflow with Python 3.8
Check in which environment Jupyter notebook is opened. If its different than the tf environment, fresh install Tensorflow there. Thanks
I accidentally deleted this file. Uninstalling TensorFlow like pip uninstall tensorflow==2.3.0 and installing it again pip install tensorflow==2.3.0 resolved the issue. Dont forget to restart the kernal
Adding my workaround/hack (TF 2.5.0 ), in case it helps someone:
In my case I already had a dozen of Visual C++ Redistributables installed ('05, '08, . all the way to 2017) - but TF was still failing with the infamous ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found error. I didn't want to download and install another redistributable, just to get TF working. (Besides, I had already run into several posts, enough to raise doubt whether installing it would actually resolve the problem.)
According to this SO post, the offending failing _pywrap_tensorflow_internal.pyd is just another DLL; so I
- downloaded (just 468 KB) and ran Dependency Walker to detect which DLLs were requested by above PYD.
- in addition to the commonly mentioned vcruntime140.dll , the PYD was also depending on a vcruntime140_1.dll .
- vcruntime140.dll was available in C:/Windows/System32/ (checked using where vcruntime140.dll ), but not vcruntime140_1.dll ; so I ran a search on my system partition C: and found several copies of vcruntime140_1.dll at other places, mainly in my home dir's AppData/Local/ (user-installed apps).
- Almost all these apps were "trusted" ones (WhatsApp, MS Teams, . ) so I just copied vcruntime140_1.dll from one of them into C:/Windows/System32/ - and the error went away.
So if you get this error even when all documented requirements are fulfilled, do a bit of debugging to find the cause of the error. It will probably save you a good deal of frustration and wasted bandwidth.
Читайте также: