5

This is a question extended from the following question on the link:

python : cannot import tensorflow-gpu

I'm trying to implement tensorflow-gpu on my Windows 10 machine. I followed what this link told me to do. I have..

  1. Successfully installed CUDA 8.0 Toolkit
  2. Successfully installed cuDNN v5.1
  3. Added Environmental variables : CUDA_Home & path variables
  4. Installed Anaconda3 (I was formerly using Anaconda3)
  5. Successfully carried out the following commands

    >conda create -n tensorflow-gpu python=3.5.2 >activate tensorflow-gpu >pip install tensorflow-gpu >activate tensorflow-gpu (tensorflow-gpu) >python >>> 

However, if I try to import tensorflow,

>>>import tensorflow as tf 

I get the following error message

Traceback (most recent call last): File "C:\Users\Froilan\Anaconda3\envs\tensorflow-gpu\lib\site- packages\tensorflow\python\platform\self_check.py", line 87, in preload_check ctypes.WinDLL(build_info.cudnn_dll_name) File "C:\Users\Froilan\Anaconda3\envs\tensorflow-gpu\lib\ctypes\__init__.py", line 347, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] This 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\Froilan\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import * File "C:\Users\Froilan\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\Froilan\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module> self_check.preload_check() File "C:\Users\Froilan\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line 97, in preload_check % (build_info.cudnn_dll_name, build_info.cudnn_version_number)) ImportError: Could not find 'cudnn64_6.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and this DLL is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 6 from this URL: https://developer.nvidia.com/cudnn 

I'm not sure what's causing the problem. I'm using an AMD ryzen 1700 CPU & GTX 1050 Ti GPU. Maybe one of those is causing the problem?

UPDATE : tensorflow with CPU works just fine. The one with the GPU is what's causing the problem

4 Answers 4

2

I believe using the command

pip install tensorflow-gpu 

installs the latest version of TensorFlow, which is currently something like 1.6. From my experience, the latest version seems to only work with CUDA 9.0, which in turn requires cuDNN 7.0.4 or 7.0.5. You can either install a specific version of TensorFlow that will work with CUDA 8.0, for example, using this command:

pip install tensorflow-gpu==1.4 

Or, you can download older versions of CUDA and cuDNN from NVIDIA. To do this, you have to create an account first (don't worry, it's free and really quick).

Older versions of CUDA here: https://developer.nvidia.com/cuda-toolkit-archive

Older versions of cuDNN here: https://developer.nvidia.com/rdp/cudnn-download

The TensorFlow website could do with being updated, as it still tells you to install CUDA 8.0 but I think that only works up to TensorFlow version 1.4.

Sign up to request clarification or add additional context in comments.

Comments

1
  • Use this command conda install -c anaconda tensorflow-gpu
  • It installs cuda toolkit and cudnn for you and does all the configuration
  • If you want to solve the above error then add the cudnn path in the PATH variable
  • You can use export PATH or go to .bashrcand set the PATH variable over there

1 Comment

If I use the command, my monitor goes black. I think it's because of the driver CUDA 8.0 uses. I've seen that using CUDA 8.0 driver could disconnect the monitor from the GPU. Do you happen to know how to 'unuse' the particular driver?
1

Your problem here is tensorflow is looking for cudnn v6. tensorflow 1.4 works with CUDA 8.0 and CUDNN 6. By default pip will install tensorflow 1.5/1.6 which requires CUDA 9.0 and CUDNN 6.0 on Windows. Check the requirements here. From my experience having the wrong sub version (i.e. 6.1) can also cause problems.

Comments

0

i had similar problem i installed lower verison of both cuda and cudnn and it solved the problem. check the tensorflow website for recommended versions of both cuda and cudnn. for me cuda 11.2 and cudnn 8.1 worked well

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.