I installed the latest version of Anaconda on my Windows 10. After installing i tried to launch it but it wouldn't launch even after trying several times. I also tried to launch the jupyter notebook and spider shortcut that was created but even that didn't work. So I tried to run it using the terminal and this is the error I recieved:
UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\capta\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\capta\anaconda3\lib\site-packages\notebook\notebookapp.py", line 49, in <module>
from zmq.eventloop import ioloop
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
I also encountered this problem after I uninstalled the Microsoft Visual Studio C++ redistributable. It fixed (DLL error) after I installed Visual Studio 2015, 2017, and 2019.
You can find it on The latest supported Visual C++ downloads
I am trying to get Tensorflow GPU support going in Python under Windows 10.
What does work;
Download and install Python v3.7.3
pip3 install --ignore-installed --upgrade tensorflow
pip3 install --ignore-installed --upgrade scipy
Run Python from a command prompt and then type import tensorflow
Works and returns no errors
I can run tensorflow Python programs on the CPU (https://github.com/cysmith/neural-style-tf if it matters)
What doesn't work;
I now uninstall CPU tensorflow and install GPU tensorflow
pip3 uninstall tensorflow
pip3 install --ignore-installed --upgrade tensorflow-gpu
Both uninstall and install finish without errors.
I download and install Cuda Toolkit 9.0 and patches.
I download and extract cuDNN and copy the relevant DLLs to the folders under C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\demo_suite\oceanFFT.exe runs as expected, so I am now assuming Cuda is installed correctly
Run Python from a command prompt window
Type import tensorflow
fails with these errors...
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\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\Username\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\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 "<stdin>", line 1, in <module>
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\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\Username\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python37\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.
>>>
The path corrctly has the Cuda entries at the start, ie
PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;
I tried uninstalling Cuda v9 and tried v8 and newest v10. Same errors.
Any ideas what I need to do to get tensorflow GPU working under Python in Windows 10?
Also tried older Python v3.6.8 after seeing some posts saying v3.7 not supported.
Same errors
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\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\Username\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, 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 "<stdin>", line 1, in <module>
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\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\Username\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, 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.
>>>
I also went back to Python v3.5.2, installed tensorflow-gpu and got the same errors...
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
Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\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\Username\AppData\Local\Programs\Python\Python35\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\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 "<stdin>", line 1, in <module>
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\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\Username\AppData\Local\Programs\Python\Python35\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Username\AppData\Local\Programs\Python\Python35\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.
>>>
So before I go mad from trying every combo of Python, Cuda and cuDNN hoping to get a working match, is there any actual steps of which version(s) to install and what sequence to make this work?
Edit: The versions I needed/used to make this work were;
Installed Python v3.6.4
pip3 install --no-cache-dir --ignore-installed --upgrade tensorflow-gpu==1.12.0
pip3 install --no-cache-dir --ignore-installed --upgrade scipy
pip3 install --no-cache-dir --ignore-installed --upgrade opencv_python-3.4.5-cp36-cp36m-win_amd64.whl
Cuda 9.0
cuDNN needs to be "Download cuDNN v7.2.1 (August 7, 2018), for CUDA 9.2"
From Tensorflow install
Windows setup
See the hardware requirements and software requirements listed above.
Read the CUDA® install guide for Windows.
Make sure the installed NVIDIA software packages match the versions
listed above. In particular, TensorFlow will not load without the
cuDNN64_7.dll file. To use a different version, see the Windows build
from source guide.
Maybe you don't have the specified file cuDNN64_7.dll
Please check if the file is present in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
Where 9.0 is the version of CUDA
Actually I have this setup working in Windows 10
Python 3.6.4
Tensorflow 1.12.0
CUDA 9.0
Edit: Some research I found this related links to the issue
Search for DLL: Tensorflow install errors
Issues related:
https://github.com/tensorflow/tensorflow/issues/22512
https://github.com/tensorflow/tensorflow/issues/22794
For all those with the „DLL load failed“ problem under Windows 10/Python 3.6.x/RTX20xx.
The combination of CUDA 10.0 (not 10.1!), cuDNN 7.5.0 works fine for me (as of 12 April 2019). I also have Visual Studio 2015 installed (but not sure if needed).
Don‘t forget to add the location of the cuDNN *.dll file (it‘s the /bin/ dir in your CUDA dir) to your PATH.
If you have CUDA 10.1, just uninstall it, install 10.0, add the cuDNN files to the 10.0 dir, and reboot.
Tensorflow can be installed using pip install tensorflow-gpu
I know people asked this question before. I believe I tried everything written in other StackOverflow questions (On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error). The new TensorFlow 1.7 requires CUDA Toolkit 9.0 and cuDNN v7.0 (both of which I added to my environment path). I also installed the latest version of Visual Studio 17. I reinstalled Python 3.5; Anaconda; CUDA Toolkit 9.0; cuDNN v7.0. Do you think its because of the new VS studio isn't compatible?
This is the error I get:
import tensorflow as tf
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
This error might be caused because of generation of your processor. I struggled with the same error for CPU mode only. Checked for 2 machines: win 7 pro, i7 1366 socket and win 7 home with i5 1366 socket with the same output.
The problem is that Tensorflow r1.7 seems to require AVX support. Check does your processor support AVX if not switch to Tensor Flow 1.5
For native instalation (python 3.5 or python 3.6)(Tensor Flow r1.5 CPU)
pip3 install tensorflow==1.5
For anaconda (Tensor Flow r1.5 CPU)
conda create -n your_env_name pip python=3.5 (or 3.6)
in next line
activate your_env_name
and finally install Tensorflow 1.5
pip install --ignore-installed tensorflow==1.5
For me two ways work on 2 machines without problems.
I have no idea if you are dealing with GPU because I am new and my graphics is not powerfull enough to use.
Enjoy!
OS:Windows 10
Python ver.:Python 2.7.13
tensorflow ver.:1.0.1
CUDA:v8.0
cudnn:v5.1
I have already set my CUDA and cudnn well.
cudnn64_5.dll is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
cudnn.h is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include
cudnn.lib is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
and added path:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
Microsoft Visual C++ 2015 Redistributable(x64) is also installed.
but still got this error:
Traceback (most recent call last):
File "keras_test.py", line 2, in <module>
from keras import*
File "C:\Python27\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Python27\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Python27\lib\site-packages\keras\utils\conv_utils.py", line 3, in <module>
from .. import backend as K
File "C:\Python27\lib\site-packages\keras\backend\__init__.py", line 83, in <module>
from .tensorflow_backend import *
File "C:\Python27\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in <module>
import tensorflow as tf
File "C:\Python27\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ImportError: No module named _pywrap_tensorflow
Failed to load the native TensorFlow runtime.
I found that there is very little information about tensorflow for python2.7 on Windows.
Is there any other solution?
Or should I switch to python 3.5.x on Windows?
Or use python2.7 on Linux?
From the docs:
TensorFlow only supports version 3.5.x of Python on Windows.
I try to use rauth in Visual Studio 2013 with Python 2.7 but it fails at the first line:
from rauth import OAuth1Session
because of a missing structures:
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7 \IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\
visualstudio_py_util.py", line 76, in exec_file
exec(code_obj, global_variables)
File "c:\users\gustav.cactus\documents\visual studio 2013\Projects\PythonApplicationRauth1\PythonApplicationRauth1\
PythonApplicationRauth1.py", line 2, in <module>
from rauth import OAuth1Session
File "C:\Python27\lib\site-packages\rauth\__init__.py", line 22, in <module>
from .service import OAuth1Service, OAuth2Service, OflyService
File "C:\Python27\lib\site-packages\rauth\service.py", line 10, in <module>
from rauth.session import OAuth1Session, OAuth2Session, OflySession
File "C:\Python27\lib\site-packages\rauth\session.py", line 16, in <module>
from rauth.oauth import HmacSha1Signature
File "C:\Python27\lib\site-packages\rauth\oauth.py", line 15, in <module>
from rauth.utils import FORM_URLENCODED
File "C:\Python27\lib\site-packages\rauth\utils.py", line 11, in <module>
from requests.structures import CaseInsensitiveDict as cidict
ImportError: No module named structures
I have installed all required modules except pycrypto which refuses to install:
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
error: Unable to find vcvarsall.bat
Any idea how to resolve this?
As noted above:
pycrypto under Windows cannot be installed like any other Python module but rather with a Windows installer package like those listed here:
http://www.voidspace.org.uk/python/modules.shtml#pycrypto