I am getting this error on Keras.
ImportError: DLL load failed: The specified module could not be found while importing Keras
What I tried?
-initially "conda install -c conda-forge keras"
-then i also followed the tensorflow install instructions on tensorflow website
-I tried installing Microsoft Visual C++ that did not solve
-Also downloaded a msvcp140_1.dll file and pasted it in the sys32 and syswow64 of windows folder,did not help
-while importing the tensorflow it is reflecting the same problem
-OS-MSW-8.1
import keras
Error in callback <bound method AutoreloadMagics.post_execute_hook of <autoreload.AutoreloadMagics object at 0x0000006394266548>> (for post_execute):
Traceback (most recent call last):
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\admin\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
As confirmed in comments, the OP was missing some of the Visual Studio redistributables. After installing appropriate (in terms of architecture) vc_redist from here everything worked fine.
Related
problem in tensorflow - ImportError: Traceback (most recent call last):
File "C:\Users\SUBHAM KUMAR\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\SUBHAM KUMAR\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\SUBHAM KUMAR\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\SUBHAM KUMAR\AppData\Local\Programs\Python\Python38\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\SUBHAM KUMAR\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.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
You need to have a 64 bit Python if you are using 32 bit. On Windows you need to have Microsoft Visual C++ 2015-2019 Redistributable (x64). If your issue is not resolved other possible reasons are mentioned here.
Note: Python binary is installed from official sources not from Windows marketplace.
Workaround for the above issue, you can create virtual environment on anaconda and install tensorflow as shown below
# Create virtual environment
conda create --name TF_VE
# When conda asks you to proceed, type y:
proceed ([y]/n)?
# Activate virtual environment
conda activate TF_VE
# Install the TF Version
conda install tensorflow
I seem to have a problem with installing tensorflow 2.0. After many attempts finally command "conda list" shows tensorflow 2.0 package successfully installed but when I try to import it in jupyter I get the error:
ImportError: Traceback (most recent call last):
File "C:\Users\giuse\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58,
in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\giuse\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\giuse\anaconda3\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\giuse\anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\giuse\anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Can anybody help please?
If you have still below error:
ImportError: DLL load failed: The specified module could not be found.
Try to install the proper version of:
visual c++ redistributable for visual studio 2019
Or try virtual environment:
Creation of the environment
conda create -n test_env python=3.x anaconda
Activation
conda activate test_env
Deactivation
conda deactivate
Getting rid of it
conda remove -n test_env --all
I have anaconda and python installed and I am trying to use tensorflow through command prompt. Can someone help?
(venv)
C:\Users\NeravDOSHI>.\venv\Scripts\activate
(venv)
C:\Users\NeravDOSHI>python --version
Python 3.7.6
(venv)
C:\Users\NeravDOSHI>pip3 --version
pip 20.1 from C:\Users\NeravDOSHI\venv\lib\site-packages\pip (python 3.7)
(venv)
C:\Users\NeravDOSHI>virtualenv --version
virtualenv 20.0.20 from c:\programdata\anaconda3\lib\site-packages\virtualenv\__init__.py
(venv)
C:\Users\NeravDOSHI>pip install --ignore-installed --upgrade
https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.13.1-cp36-cp36m-win_amd64.whl
ERROR: tensorflow-1.13.1-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
(venv)
C:\Users\NeravDOSHI>python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "c:\programdata\anaconda3\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:\programdata\anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "c:\programdata\anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
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 "<string>", line 1, in <module>
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
from tensorflow.python import pywrap_tensorflow
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "c:\programdata\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "c:\programdata\anaconda3\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:\programdata\anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "c:\programdata\anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Please follow the instructions from TensorFlow website. I recommend please install Tensorflow 2, if you are using lower versions.
You need to download and install/update the Microsoft Visual C++ 2015-2019 Redistributable (x64) from here.
If you are facing any other issues possible reasons are
Your CPU does not support AVX2 instructions
Your CPU/Python is on 32 bits
There is a library that is in a different location/not installed on your system that cannot be loaded.
Please refer tested build configurations for windows CPU and GPU.
I am trying to import the tensorflow model into my code but its always thowing me the dll Link error, i have tried installing various versions but none seem to work.
i have installed multiple versions of tensorflow
uninstalled and reinstalled anaconda
tried installing tensorflow using wheelfiles
ImportError: Traceback (most recent call last): File
"C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 58, in
from tensorflow.python.pywrap_tensorflow_internal import * File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 28, in
_pywrap_tensorflow_internal = swig_import_helper() File "C:\ProgramData\Anaconda3\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:\ProgramData\Anaconda3\lib\imp.py",
line 243, in load_module
return load_dynamic(name, filename, file) File "C:\ProgramData\Anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
I expect the tensorflow to be successfully install and run on my machine
Note : i use windows 10 OS
I think the problem may be due to protobuf, try downgrading protobuf to 3.6.0 using:
pip install protobuf==3.6.0
If not try installing tensorflow using wheel file provided in the below link:
https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.12.0/py36/CPU/sse2
Hope this could solve your issue.
I'm having problems in importing tensorflow in python3:
>>> import tensorflow as tf
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
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 am using Nvidia drivers version 381.09 beta, as version 375 has this bug: https://askubuntu.com/questions/896221/strange-artifacts-along-window-borders-after-waking-computer-from-sleep-mode?noredirect=1&lq=1
I have install CUDA 8.0 and cuDNN-v6.0:
rharish#rharish-GL552VW:~$ cd /usr/local
rharish#rharish-GL552VW:/usr/local$ ls
bin cuda etc include man share
computecpp cuda-8.0 games lib sbin src
Also, libcusolver.so.8.0 exists in /usr/local/cuda/lib64/:
libcusolver.so.8.0 in 'ls' output
I have uninstalled and reinstalled CUDA, cuDNN, and built tensorflow from sources. This problem has been occuring since updating the Nvidia drivers to version 381.09 beta. Any help?
Found the solution:
I reinstalled nvidia-381, CUDA-8.0 (using the runfile) and cuDNN 6.0. Then I added the following in my .bashrc:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64/
No need for reinstallation. Install nvidia-cuda-dev:
sudo apt install nvidia-cuda-dev
Install cuDNN (which you download from https://developer.nvidia.com/cudnn), and set LD_LIBRARY_PATH accordingly (to cuda/lib64).
You could be having this problem if you installed the latest version of CUDA (9.0). If this is the case, you'll have the libcusolver.so.9.0 file or directory on your computer, but not 8.0, so python can't find it to import. Tensorflow doesn't yet support CUDA 9.0 (as of Oct 18th 2017).
To fix this, install CUDA 8.0, which can be found here. You can find all their legacy releases at the bottom of the main download page.
I faced this error due to incompatibility between Tensorflow version with CUDA.
I had tensorflow_gpu-1.3.0, CUDA 9 and cuDNN 7 which are incompatible as per this https://www.tensorflow.org/install/source#tested_build_configurations
so I uninstalled tensorflow_gpu-1.3.0 and installed tensorflow_gpu-1.5.0 and it worked fine
In addition to having the paths correctly set, the version of Tensorflow you have installed must be compatible with the CUDA driver version you have in your system otherwise it won't work.
See the link