tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
183.19k stars 73.98k forks source link

Win10: ImportError: DLL load failed: The specified module could not be found #22794

Closed damcclane closed 5 years ago

damcclane commented 5 years ago

System information:

Have I written custom code: No OS Platform and Distribution: Windows 10 Pro updated Mobile device: None TensorFlow installed from: pip install TensorFlow version: 1.11.0 Python Version: 3.6.6 Bazel version: not installed CUDA/cuDNN version: CUDA 9.0, cuDNN 8.0 GPU model and memory: GF-GTX970 STRIX Exact command to reproduce: pip install tensorflow pip install tensorflow-gpu python import tensorflow as tf

Problem

I have had this error consistently even after trying to downgrade to older versions of CUDA tool, cuDNN, python, tensorflow and tensorflow-gpu. I have updated my enviornment variables. I have installed Visual C++ Redistributable Update. I have read and tried to follow the solutions from other similar issues (such as #10033 and #17101), but have not succeeded in fixing the problem.

Log

C:\Users\user>python Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 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\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\user\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\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\user\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 "", line 1, in File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow__init__.py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\user\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\user\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\user\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.

tensorflowbutler commented 5 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. Mobile device

damcclane commented 5 years ago

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. Mobile device

Ok done.

kennedyCzar commented 5 years ago

I had the same issue while trying to use tensorflow-gpu on windows 10. Since i couldn't get it to work on cuDNN10..i opted for 9 instead using...

conda create --name tf-gpu conda install -c aaronzs tensorflow-gpu conda install -c anaconda cudatoolkit conda install -c anaconda cudnn conda install keras-gpu

you can also check the fullpost on https://www.pugetsystems.com/labs/hpc/The-Best-Way-to-Install-TensorFlow-with-GPU-Support-on-Windows-10-Without-Installing-CUDA-1187/

Credit to Dr Donald Kinghorn

umitkilic commented 5 years ago

I have same problem with you @damcclane . How did you solve ?

Win10 x64, python 3.6, cuda9 with cudnn 7.0.5 and also Win10 x64, python 3.7, cuda10 with cudnn 7.3.1

Both has the same problem. My graphic card is Nvidia GeForce 1050 Ti

CorentinJ commented 5 years ago

Same issue. Win10 x64, python 3.5, tensorflow-gpu 1.11.0, CUDA 8 with CUDNN 6 installed.

starcream commented 5 years ago

Same problem,Win10 x64,python 3.6 ,cuda 9 with cudnn 7.0

henry-huynh-3508 commented 5 years ago

Same problem, anyone knows how to solve this?

tcllst commented 5 years ago

Same problem here… :(

CorentinJ commented 5 years ago

I've had this issue in the past and it was because I had the wrong version of CUDNN. You could try downloading a few of them and see if any of those work.

ymodak commented 5 years ago

I would like to encourage all who are facing this issue to create a new issue on TensorFlow repo so that we can focus on solving your problem on individual basis since the system config can vary from person to person. Thanks!

tcllst commented 5 years ago

Fixed, Thenks!

On Wed, Oct 17, 2018 at 10:39 AM Corentin Jemine notifications@github.com wrote:

I've had this issue in the past and it was because I had the wrong version of CUDNN. You could try downloading a few of them and see if any of those work.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tensorflow/tensorflow/issues/22794#issuecomment-430676267, or mute the thread https://github.com/notifications/unsubscribe-auth/AYfA4TRxTaZ7pKfyszlWqPGknt_ohvlaks5ul082gaJpZM4XLOd- .

umitkilic commented 5 years ago

I installed CUDA9 and cuDNN 7.0.5 again and restarted the computer. The related problem has just gone.

Darshu1315 commented 5 years ago

I am using Cuda10 and cudaNN 7.3.1.20 and i got the following error can someone tell the solution @tensorflowbutler Traceback (most recent call last): File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Darshan\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\Darshan\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\Darshan\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 "", line 1, in File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow__init__.py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Darshan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Darshan\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\Darshan\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\Darshan\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.

iteratorlee commented 5 years ago

Same issue, Windows 10 x64, python3.5, tensorflow-gpu 1.11.0, CUDA 10.0, cudnn 7.3.1, my graphics card is GTX 1070Ti

ymodak commented 5 years ago

@iteratorlee

I would like to encourage all who are facing this issue to create a new issue on TensorFlow repo so that we can focus on solving your problem on individual basis since the system config can vary from person to person. Thanks!

catruck commented 5 years ago

Same problem, on cuda 10, when I install anaconda I have missed the PyHamcrest, after I install "pip install PyHamcrest" all worked fine until today. I get the same error.

mragon2 commented 5 years ago

I am facing the same issues. The problem appears also in importing another package named PyQSTEM for electron microscopy simulation. If someone can find a way to fix the problem, could please share here the solution? Thanks

BirdeeChen commented 5 years ago

Same issue, Windows 10 x64, python3.5, tensorflow-gpu 1.11.0, CUDA 10.0, cudnn 7.3.1, my graphics card is GTX 1070Ti

Same issue, and I tried to install CUDA 9.0, but NVIDIA inform me the driver is not compatible graphic hardware, but with CUDA 10.0, there is no such warning.

BirdeeChen commented 5 years ago

Lucky, Issue solved when getting visual studio 2017 with C++ package installed, Windows 10 x64, python3.6.7, tensorflow-gpu 1.11.0, cudnn 7.3.1, both cuda 9.0 & cuda 10.0 installed(not checking which is the right one), my graphics card is GTX 1070Ti.

WuYunfan commented 5 years ago

I finally solve the problem by installing cuda 9.0 instead of 9.2 or 10.0 with tensorflow 1.12.0 and cudnn 7.4.1.5

boldt commented 5 years ago

I can confirm, that the following assembly does not work on Windows 10:

Additional infos:

I also get the message

ImportError: DLL load failed: The specified module could not be found.

Unfortunately, it does not say which module is missed.

[EDIT]

Just realized, that you write:

TensorFlow supports CUDA 9.0.

I'll reinstall now.

sssmayank commented 5 years ago

Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Program Files\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:\Program Files\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Program Files\Python36\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: %1 is not a valid Win32 application.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ABC\Desktop\pyprograms\tensorflowbasic\1.py", line 1, in import tensorflow as tf File "C:\Program Files\Python36\lib\site-packages\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Program Files\Python36\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Program Files\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:\Program Files\Python36\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Program Files\Python36\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: %1 is not a valid Win32 application.

levicki commented 5 years ago

My install:

Windows 10.0.17763.134 x64 NVIDIA Driver 416.92 CUDA 10.0.130 CUDNN 7.4.1.5 for CUDA 10.0 Python 3.6.7 GeForce GTX 1080 Ti

The cause of this error seems to be people installing Python without Tcl/Tk support not realizing that Tcl is necessary for SWIG and module imports. I just tested this and in my case it was not enough to modify the Python installation to add Tcl/Tk -- I had to delete everything and install from scratch and now I am not getting the error anymore.

TL;DR -- just fully remove and reinstall Python with Tcl/Tk option selected.

sulaimanvesal commented 5 years ago

After spending almost two days, I finally solved the problem by installing:

Thanks to @WuYunfan 💯

linsui commented 5 years ago

First I install

and I got this error. Then I uninstall tf 1.12 and install tf 1.10 . It ask me for cudart64.dll. I add it into path and tf works. Then I reinstall tf 1.12 and all works well.

ljzsky commented 5 years ago

TensorFlow supports CUDA 9.0

levicki commented 5 years ago

@ljzsky While it is true that TensorFlow will officially support CUDA 10.0 from version 1.13, TensorFlow 1.12 can be (and has been) built against CUDA 10.0 and it works with it just fine.

levicki commented 5 years ago

@linsui What you say makes absolutely no sense. TensorFlow is a library which has no means to ask you for cudart64.dll.

linsui commented 5 years ago

@levicki I don't know why but tf1.10 shows different message from tf1.11 and tf1.12.

thischeng commented 5 years ago

l got this problem Traceback (most recent call last): File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\anaconda\envs\tensorflow\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:\anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\anaconda\envs\tensorflow\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 "", line 1, in File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\anaconda\envs\tensorflow\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:\anaconda\envs\tensorflow\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\anaconda\envs\tensorflow\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.

please can someone tell me how to solve this problem?

levicki commented 5 years ago

@thischeng This is not a support forum, this is a place where issues are reported along with enough information for developers to reproduce them, and if they turn out to be an actual issue in the tensorflow code they will be fixed in one of the future releases.

It seems that you have not even bothered to read this thread, because there are several workarounds posted above including mine.

Finally, asking for help without specifying full hardware and software configuration and without listing what steps you have taken so far to try to solve the issue on your own is rude to say the least.

thischeng commented 5 years ago

@levicki thank you for you criticism , i did' t see it clearly, next time i will pay attention to my way of asking questions.

andpi314 commented 5 years ago

I encountered the same issue. My configuration is:

After spending almost a day figuring out why tensorflow did not find the correct dll file, I found a guide on how to install cudnn that, by the way, is not as simple as it seems. The guide is written by nVidia and here you are the actions I follow.

  1. Download from nVidia official site, the correct cudnn version for your configuration.
  2. Then extract cuda folder, it does not matter where you extract it.
  3. Open File Explorer and go to the directory where you installed CUDA, in my case that was C:/Program Files/NVIDIA GPU Computing Toolkit.
  4. Go to CUDA/v9.0/lib/x64. Here you have to put the file named "cudnn.lib" that you can find inside CUDA/lib/x64 (cudnn package, downloaded from nVidia)
  5. Repeat the process for (left cudnn package, right CUDA installation path):
    • CUDA/bin/cudnn64_7.dll -> CUDA/v9.0/bin
    • CUDA/include/cudnn.h -> CUDA/v9.0/include
  6. Now you have to check if the environment variable is set correctly. Be sure CUDA_PATH variable, with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 value is present, if not add it.
  7. Enjoy tensorflow-gpu working on your system
Scoobybrew commented 5 years ago

I encountered the same issue. My configuration is:

  • CUDA Toolkit v9.0 (installed without Visual Studio support)
  • Tensorflow-gpu v 1.12.0 (installed with pip)
  • cudnn v7.4.1.5 CUDA v9.0 compatible.
  • nVidia GeForce 1070
  • Windows 10 Home

After spending almost a day figuring out why tensorflow did not find the correct dll file, I found a guide on how to install cudnn that, by the way, is not as simple as it seems. The guide is written by nVidia and here you are the actions I follow.

  1. Download from nVidia official site, the correct cudnn version for your configuration.
  2. Then extract cuda folder, it does not matter where you extract it.
  3. Open File Explorer and go to the directory where you installed CUDA, in my case that was C:/Program Files/NVIDIA GPU Computing Toolkit.
  4. Go to CUDA/v9.0/lib/x64. Here you have to put the file named "cudnn.lib" that you can find inside CUDA/lib/x64 (cudnn package, downloaded from nVidia)
  5. Repeat the process for (left cudnn package, right CUDA installation path):
  • CUDA/bin/cudnn64_7.dll -> CUDA/v9.0/bin
  • CUDA/include/cudnn.h -> CUDA/v9.0/include
  1. Now you have to check if the environment variable is set correctly. Be sure CUDA_PATH variable, with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 value is present, if not add it.
  2. Enjoy tensorflow-gpu working on your system

Thank you! that solved my problem! My system: windows 10 python 3.6 Cuda Toolkit v9.0 cudnn 7.4.2 Graphics card: Nvidia p4000

After uninstalling v10 and its associated cudnn and then installing the above mentioned and then following the tutorial from (andpi314) Tensor Flow GPU up and running.

anna-mo commented 5 years ago

This is my situation, check the cudnn's copy &paste, make sure bin,include,lib, the file of the three folders are copying and pasting to the same path of the cuda, i just copy to the wrong path ,after checking the system path of cuda ,do the copy &paste again,then it runs correctly.

bdevyansh commented 5 years ago

Traceback (most recent call last): File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\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\SPECTRE\Anaconda3\envs\tfpose\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\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 "", line 1, in File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\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\SPECTRE\Anaconda3\envs\tfpose\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\SPECTRE\Anaconda3\envs\tfpose\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.

Asichurter commented 5 years ago

I met the same situation and my config is: CUDA10 cudnn v7.4 for CUDA10 Tensorflow-gpu v1.12.0

I see the solutions above that suggest the CUDA9, but the information in my GeForce Controler shows my GPU GTX1050Ti only supports CUDA10(it writes "NVIDIA CUDA 10.0.132 driver", actually I don't know what it means), how can I resolve this?

umitkilic commented 5 years ago

I installed CUDA9 and cuDNN 7.0.5 again and restarted the computer. The related problem has just gone.

@Asichurter I have the same graphic card and have no problem with above combination.

DVLP commented 5 years ago

SOLUTION! If you're trying to run TF with CUDA 10

Tensorflow 1.12 DOES NOT support CUDA 10 but nightly build DOES

There are 2 solutions

  1. Remove TF 1.12 and install nightly build 1.13 pip uninstall tensorflow-gpu pip install tf-nightly-gpu

Alternative solution: Downgrade CUDA to 9.0

Remember about copying CUDNN files to right location in CUDA installation folder every time when reinstalling

ERDataDoc commented 5 years ago

I had the same problems, and tried most of the proposed fixes for about 3 hours with no luck. However I found the post by kennedyCzar at the top - and this fixed my issue ("ImportError: DLL load failed: The specified module could not be found.") I highly encourage readers to try this approach as it is fast and easy. I specifically went to the referenced blog post by Dr. Donald Kinghorn and followed the instructions.

See below for copy of kennedyCzar's post from Oct 16, 2018:

I had the same issue while trying to use tensorflow-gpu on windows 10. Since i couldn't get it to work on cuDNN10..i opted for 9 instead using...

conda create --name tf-gpu conda install -c aaronzs tensorflow-gpu conda install -c anaconda cudatoolkit conda install -c anaconda cudnn conda install keras-gpu

you can also check the fullpost on https://www.pugetsystems.com/labs/hpc/The-Best-Way-to-Install-TensorFlow-with-GPU-Support-on-Windows-10-Without-Installing-CUDA-1187/

Credit to Dr Donald Kinghorn

tsafs commented 5 years ago

I had CUDA 10 running with tensorflow-gpu v1.12. I didn't read the small prints and thus missed that this version didnt work with CUDA 10. Downgraded to CUDA 9 and it works now.

mario98 commented 5 years ago

I had the same issue with TensorFlow 1.12.0 and none of the solutions worked for me. Then I downgraded to TensorFlow 1.10.0 and this time the error message was much more informative. It told me that cudart64_90.dll could not be found which is located in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin. After adding this specific path to the PATH variable, it run smoothly without errors.

This makes me wonder if there is a bug in TensorFlow so that it fails to navigate to the "bin" subfolder itself given that C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0 is already present in numerous environment variables like CUDA and CUDA_HOME, so it should be able to find it.

Secondly, it makes me wonder why TensorFlow 1.12.0 has so much less informative error messages. In 1.12.0 it just says that some DLL could not be imported. In 1.10.0 it showed me exactly which DLL is missing and even proposed the working solution to add it to PATH. This is a way better error handling and I suggest that you revisit the commit from the person who thought obscuring error messages was a good idea.

komcat commented 5 years ago

SOLUTION! If you're trying to run TF with CUDA 10

Tensorflow 1.12 DOES NOT support CUDA 10 but nightly build DOES

There are 2 solutions

  1. Remove TF 1.12 and install nightly build 1.13 pip uninstall tensorflow-gpu pip install tf-nightly-gpu

Alternative solution: Downgrade CUDA to 9.0

Remember about copying CUDNN files to right location in CUDA installation folder every time when reinstalling

confirm this solution

use tf-nightly-gpu win10 cuda 10.0 python 3.6.4 geforce 960M cudnn64_7

luorixiangyang commented 5 years ago

I finally solve the problem by installing cuda 9.0 instead of 9.2 or 10.0 with tensorflow 1.12.0 and cudnn 7.4.1.5

but i download the cudnn7.4.1.5 instead of cudnn7.0.5 still encounter this error. my configuration following: cuda 9.0 cudnn7.4.1 pip install tensorflow-gpu==1.12.0 python 3.6.4 nvidia geforce 1080TI

luorixiangyang commented 5 years ago

I finally solve the problem by installing cuda 9.0 instead of 9.2 or 10.0 with tensorflow 1.12.0 and cudnn 7.4.1.5

but i download the cudnn7.4.1.5 instead of cudnn7.0.5 still encounter this error. my configuration following: cuda 9.0 cudnn7.4.1 pip install tensorflow-gpu==1.12.0 python 3.6.4 nvidia geforce 1080TI

Final i downgrade the bazel version to 0.20.0 (from 0.21.0) solve this issue. but i don't know why can't compatible for lastst bazel version.

Shawnnnnn commented 5 years ago

cuda 10.0 cudnn7.4.2 pip install tf-nightly-gpu python 3.6.4 nvidia geforce 1070

it works.

byte55 commented 5 years ago

cuda 10.0 cudnn7.4.2 pip install tf-nightly-gpu python 3.6.4 nvidia geforce 1070

it works.

It is working for me now as well. Thanks for it. Just a note: I was unable to properly uninstall TF and had a lower Python version. I uninstalled Python completely and installed version 3.6.8 instead of 3.6.4. Then used pip install tf-nightly-gpu to install TF and is working now

AlexMylnikov commented 5 years ago

Installation of Microsoft Build Tools 2015 helps me with this issue. It works now.

SuperKuooo commented 5 years ago

I have same problem with you @damcclane . How did you solve ?

Win10 x64, python 3.6, cuda9 with cudnn 7.0.5 and also Win10 x64, python 3.7, cuda10 with cudnn 7.3.1

Both has the same problem. My graphic card is Nvidia GeForce 1050 Ti

tensorflow doesn't support python 3.7 you can create a different environment with lower python through anaconda

adityaradk commented 5 years ago

I had the exact same issue. According to the GPU Support Guide, I have all the correct versions of CUDA and cuDNN installed - CUDA 9.0 and cuDNN 7.4.2.24.

What ended up working for me was entering the following commands after installing all the dependencies:

SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;%PATH%
SET PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64;%PATH%
SET PATH=C:\tools\cuda\bin;%PATH%

The cuda folder from your cuDNN zip must be copied to C:\tools\.

Hope this was helpful.