tensorflow: Tensorflow 2.1.0 - DLL load failed

System information

  • OS Platform and Distribution: Windows 10
  • TensorFlow installed from (source or binary): pip install tensorflow-gpu==2.1.0rc2
  • TensorFlow version (use command below): 2.1.0rc2
  • Python version: 3.7.4
  • CUDA/cuDNN version: CUDA 10.1, cuDNN 7.6.5 associated with CUDA 10.1
  • GPU model and memory: GTX 1060 6GB

Describe the problem

I installed the pre-release using pip install tensorflow-gpu==2.1.0rc2. I installedCUDA 10.1 with cuDNN 7.6.5. When running import tensorflow, I get a

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

It probably means there is an issue with the CUDA installation, or a bug somewhere. Tensorflow 2.1.0 is supposed to be compatible with CUDA 10.1.

In my system environment variables, path contains:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include

Source code / logs

File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
  module = self._system_import(name, *args, **kwargs)
File "C:\Users\johndoe\AppData\Local\Continuum\anaconda3\envs\dummy_env_name\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
  _pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\johndoe\AppData\Local\Continuum\anaconda3\envs\dummy_env_name\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\johndoe\AppData\Local\Continuum\anaconda3\envs\dummy_env_name\lib\imp.py", line 242, in load_module
  return load_dynamic(name, filename, file)
File "C:\Users\johndoe\AppData\Local\Continuum\anaconda3\envs\dummy_env_name\lib\imp.py", line 342, in load_dynamic
  return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 36 (3 by maintainers)

Most upvoted comments

@ravikyram @mihaimaruseac

The solution proposed by @galocen in #35749 solves the issue for me. So if anyone has this issue, make sure to download the latest microsoft visual c++ redistributable from here.

Thank you all for your help, this issue is now solved, closing it.

@aeropia: Your issue seems different, feel free to open a new one describing it in more details.

i fix this by downgrading to

pip install tensorflow=2.0

i fix this by downgrading to

pip install tensorflow=2.0

problem solved!

I ran through this issue too during an update of mt TF environment. The installation of latest Visual C redistribuable tools solved the issue for me too obviously. This solution is well documented in build from source for windows https://www.tensorflow.org/install/source_windows#install_visual_c_build_tools_2019 BUT it should also be documented as a requirement in the PIP based installation process and even better checked during the pip install if it is possible to echoe an explicite warning if msvcp140_1.dll has not been found. It would save time and nerves on many people that are not building from sources.