When I'm trying to run my Tensorflow code inside my conda environment myEnv001, I got the error message dlerror: cudart64_110.dll not found. I'm aware that my error is similar to a previous post, which says I didn't install CUDA.
I have CUDA 10.1 installed, but anyway I tried to re-install CUDA 10.1 for myEnv001. I ran below at my terminal, and CUDA 10.1 is installed successfully in myEnv001
> conda activate myEnv001
(myEnv001) > conda install -c anaconda cudatoolkit=10.1
But when I tried to run my Tensorflow code I still have the same error message... How can I fix it?
My library
conda: 4.10.1
Tensorflow installed in myEnv001: 2.6.0
cudatoolkit installed in myEnv001: 10.1.243
According to Tested build configurations for TF 2.6, the compatible CUDA is 11.2 and cuDNN is 8.1.
For the benefit of community providing compatibility versions are as shown below
For more details, you can refer windows and Linux/macOS tested build configurations for CPU and GPU.
Related
I have encounter "I tensorflow/stream_executor/cuda/cuda_dnn.cc:368] Loaded cuDNN version 8400
Could not load library cudnn_cnn_infer64_8.dll. Error code 193"
will working with TensorFlow.
version:
TensorFlow 2.8
CUDA 11.6
CUDNN 8.4
The versions you installed for TensorFlow and NVIDIA CUDA probably don't match.
Try using one of the versions tested here: Tensorflow GPU Source Install
Don't forget to install "tensorflow-gpu" module instead of "tensorflow" in order to use NVIDIA GPU Acceleration.
i simply used conda insted pip to install cuda and cudnn. then used pip for the tensorflow gpu instalation. vrsions that worked with each other are cuda 11.2 and tensorflow2.10. anything above 2.10 not suport gpu
When I create a python 3.8 environment using tensorflow-gpu 2.5.0 package using conda, I get the error "Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found". However, I have an existing python 3.7 environment that also has tensorflow-gpu 2.5.0, and it is able to find the library OK.
Interestingly enough, if I clone the python 3.7 environment where I'm able to load the library, it also loads in the cloned environment, but if I create a new python 3.7 environment from scratch with tensorflow-gpu 2.5.0, I get the error in that new environment.
I'm not sure why I'm able to load the library in the one environment, but not the others, since the library is in the same location in each of the environments, and it should be a link back to the same file in the package cache, anyhow.
In the python 3.7 environment where I am able to load the cudart64_110.dll, the following relevant packages are installed:
# Name Version Build Channel
cudatoolkit 11.3.1 h280eb24_9 conda-forge
python 3.7.12 h7840368_100_cpython conda-forge
tensorflow 2.5.0 gpu_py37h23de114_0
tensorflow-base 2.5.0 gpu_py37hb3da07e_0
tensorflow-gpu 2.5.0 h17022bd_0
In the python 3.8 environment where I'm not able to load cudart64_110.dll, the following relevant packages are installed:
# Name Version Build Channel
cudatoolkit 11.3.1 h280eb24_9 conda-forge
python 3.8.12 h7840368_2_cpython conda-forge
tensorflow 2.5.0 gpu_py38h8e8c102_0
tensorflow-base 2.5.0 gpu_py38hb3da07e_0
tensorflow-gpu 2.5.0 h17022bd_0
Note that both environments include the same cudatoolkit version.
Also, I do realize that I'm mixing channels. However, (a) tensorflow 2.x is not available from conda-forge, and (b) that shouldn't matter in this case since I am able to load tensorflow with CUDA in one environment, but not the other.
For tensorflow_gpu==2.5.0, you need to install CUDA 11.2.
Please check the below tested build configuration details and install the suitable cuDNN and CUDA to use TF-gpu 2.5.
Version Python version Compiler Build tools cuDNN CUDA
tensorflow_gpu-2.7.0 3.7-3.9 MSVC 2019 Bazel 3.7.2 8.1 11.2
tensorflow_gpu-2.6.0 3.6-3.9 MSVC 2019 Bazel 3.7.2 8.1 11.2
tensorflow_gpu-2.5.0 3.6-3.9 MSVC 2019 Bazel 3.7.2 8.1 11.2
Follow this link to install specified CUDA and cuDNN in your system.
The machine I'm using is with Titan XP and running Ubuntu 18.10. I'm not the owner so I'm not sure how it was configured previously. The cuda version is 9.*, most likely 9.0. There is no folder like /usr/local/cuda. Though it sounds strange (because no Cuda is compatible with 18.10), previously it worked pretty well both for Tensorflow and Pytorch. Now, when running tensorflow-gpu v1.12.0 in python 2.7, cudatoolkit 9.2 and cudnn 7.2.1 (this worked well previously without any change), it reports:
ImportError: libcublas.so.9.0: cannot open shared object file: No such file of directory
But, when I change my conda env to python 3.6 with pytorch 0.4.1 , cudatoolkit 9.0 and cudnn 7.6 (they are shown in pycharm). There is:
torch.cuda.is_available() # True
This shows that GPU is running in Pytorch code. Also I've checked GPU RAM by nvidia-smi, when Pytorch is running, RAM is occupied.
Although there is no Cuda folder like /usr/local/cuda/, when I run:
nvcc - V
There is:
Cuda compilation tools, release 9.1, V9.1.85
Can someone give me a hint about how these strange things happen? What should I do to make my tensorflow-gpu works? I get totally confused orz.
Anaconda environments install their own version of the CUDA toolkit when you install things like pytorch and tensorflow-gpu with conda. That looks like it's how your Python 3.6 environment was set up. Is your 2.7 version of Python a system install or part of another Python environment? It's possible that your Tensorflow was built against a CUDA toolkit that is no longer installed, for whatever reason, or in any case that you were trying to use Tensorflow while not having the path to the libraries that it was built against in your LD_LIBRARY_PATH (perhaps because of an unusual install location)
You can type which nvcc to see which part of your PATH is currently pointing to that executable. That will tell you where your CUDA toolkit is installed. I'm guessing that your PATH was still pointing to a conda environment when you last ran nvcc, or to some version of the CUDA toolkit in an unusual install location in any case.
First, I'd suggest abandoning any effort to use your system python with Tensorflow. My suggestion is to either modify or create a new conda environment and install tensorflow-gpu with conda, which will also install the CUDA toolkit for that environment. Note that your CUDA install will not be in /usr/local/cuda if you go down this path, it'll be located inside your conda environment instead.
I started learning about the tensorflow recently and decided to switch to the GPU version, because it is much faster, but I can not import it, it always gives the same error.
I already tried:
Installing it by pip, in python 3.6.8, cuda 10 and the most recent cuDNN for cuda 10
I tried reinstalling python, CUDA and cuDNN
Tried installing Visual Studio and installed CUDA 9 and cuDnn
I tried installing the latest Anaconda, created a "default" env and another in python 3.6 (also tried in 3.5), pip install tensorflow-gpu in both cases
my last attempt was to follow a tutorial on youtube, I did exactly as demonstrated (https://www.youtube.com/watch?v=KZFn0dvPZUQ)
Everything i tried returned the same error.
Traceback: https://pastebin.com/KMEsZAmq
The complete code: https://pastebin.com/7tS0Rd5S (was working on CPU version)
.
My Specs:
i5-8400
8 GB Ram
GTX 1060 6GB
W10 home x64
just have a look here:
https://www.tensorflow.org/install/gpu
Tensorflow supports CUDA 9.0, you will need to downgrade your CUDA or use one of the tensorflow's docker images:
https://www.tensorflow.org/install/docker
via docker it won't use your CUDA drivers
This is an issue that many of us must have come across. While installing tensorflow, this is one of the error messages that pops up for most of the users. I could not install Tensorflow 1.10.0 due to the following error that I posted a few days back at
ImportError: Could not find 'cudnn64_7.dll'
I am using Windows 10 and was trying to implement
import tensorflow as tf
through Conda environment.
What can I do to resolve this issue?
1) Go to the cuDNN Archive
2) Click on Download cuDNN v7.6.1 (June 24, 2019), for CUDA 10.0
(you need CUDA 10 installed. NOT 10.1. If you installed the wrong version, uninstall
it and install the 10 which works with tensorflow-gpu)
3) Click on the link for your operating system.
4) Unzip it. It should unzip to a folder called CUDA.
5) Go into the CUDA folder and copy the contents
6) Open the installed CUDA 10 location. For windows 10 it is "Download cuDNN v7.6.1 (June 24, 2019), for CUDA 10.0"
7) Paste the contents from your clipboard to the folder.
8) have a coffee. You are done!
Jeremy Demers' answer worked for me, and I was able to repeat his process. However, I used cuDNN 10.1 instead of version 10 and installed tensorflow version 2.4.0-dev20200705 first via pip install tensorflow-gpu, and then `pip install tensorflow-nightly to get the latest build. Hardware: 2060 Super, 8GB.
Edit:
The recommended way to get tensorflow nightly via pip is:
pip install tf-nightly
Here is what I did.
Step 1) Installed 'NVIDIA GEFORCE EXPERIENCE' in my computer to check my Driver version.
Step 2) The driver version was an old one. Update was available. So I updated my Graphic driver.
My GPU properties now are:-
NVIDIA GEFORCE EXPERIENCE Version 3.14.1.48
GeForce 940MX
Driver Version 398.82
Intel(R) Core(TM) i5-7200U CPU #2.50GHz
7.9 GB RAM
Now, through conda environment ( I created an environment named 'tensorflow' ), when I executed the statement
(tensorflow) C:\Users\Arnab Sinha>pip install --ignore-installed --upgrade tensorflow-gpu
I encountered the following message :-
pandas 0.23.4 requires python-dateutil>=2.5.0, which is not installed.
pandas 0.23.4 requires pytz>=2011k, which is not installed.
I then installed the required packages by executing the following commands one after the other
pip install python-dateutil
and
pip install pytz
after which I ran the command in Python 3.6.6
import tensorflow as tf
and then
print(tf.__version__)
which gave the output
1.10.0
Here is how I installed Tensorflow 1.10.0 into my computer. The Anaconda Navigator however does not have the update of Tensorflow 1.10.0. Please inform me if you have found the update for it.