Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow 1.15 + CUDA + cuDNN installation using Conda

I am trying to install tensorflow-gpu 1.15 using Conda for an easy install of CUDA and cuDNN. The problem is that checking the compatibility chart of the official web I need python 3.6, CUDA 10.0 and cuDNN 7.4.

Searching the Conda rep via conda search cudnn it says that there isn't cuDNN 7.4. Is there any other way to install the required packages? Or maybe tensorflow 1.15 also works with other combinations of versions?

As a side note, python 3.6, tensorflow-gpu 1.15 and CUDA 10 install correctly, but it seems I can't use the GPU correctly without cuDNN. I just recently started using Conda, so maybe there is a straight forward way to do this that I don't realize. My Conda version is 4.9.1 (miniconda version).

---update---

Just in case I add the error while trying conda create -n myenv -c conda-forge tensorflow-gpu=1.15:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: - 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                                                                                                                                                        

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions

Package _tflow_select conflicts for:
_tflow_select==2.1.0=gpu
tensorflow==1.15.0 -> _tflow_select[version='2.1.0|2.3.0|2.2.0',build='gpu|mkl|eigen']
Note that strict channel priority may have removed packages required for satisfiability.
like image 570
Aurelie Navir Avatar asked Nov 12 '20 21:11

Aurelie Navir


People also ask

Can you install cuda through conda?

Installing Cuda Toolkit and cudaDNN The advantage of using anaconda is you can have multiple versions of the Cuda toolkit in your System in different virtual environments. To install Cuda Toolkit, Open Anaconda Prompt, activate the virtual environment. It will install all the dependent packages.

How do I install cuDNN in Anaconda?

There is a workaround for this problem. install conda-toolkit using conda enviroment and download the latest matching CuDNN version from Nvidia CuDNN page for installed cuda-toolkit. Use tar and unzip the packages and copy the CuDNN files to your anaconda environment.


3 Answers

I would let conda handle all the dependencies itself by installing tensorflow via conda, not pip. The GPU version of tensorflow is available e.g. in the popular conda-forge channel:

conda create -n myenv -c conda-forge tensorflow-gpu=1.15
like image 84
P-Gn Avatar answered Oct 20 '22 22:10

P-Gn


I am not sure if that is the problem, but I installed the following way

conda create -n tensorflow1.15 python=3.5
conda activate tensorflow1.15
conda install cudatoolkit=10.0
conda install cudnn=7.3.1
pip3 install tensorflow-gpu==1.15

And it seems to works perfectly with the GPU. I didn't know that cuDNN 7.3.1 worked like 7.4. The best way is to install tensorflow with conda, but it give me an error of trying to install tensorflow-gpu=2.X.

Also maybe it's interesting to say that you can search CUDA and similar official installers with conda search -c nvidia <packageName>.

like image 39
Aurelie Navir Avatar answered Oct 20 '22 21:10

Aurelie Navir


The best setup for TensorFlow 1.15 is to follow this guide here: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/tensorflow-1.14/install.html#tf-install. The CUDA version which is recommended is 10.0 and the cudNN version 7.6.5

Attention to the protobuf version which will be installed, if you execute the gpu version it's 4.21.1, but you have to rewrite it with the command: pip install --upgrade tensorflow-gpu==1.15 "protobuf<4.0". If you use the cpu version its recommended to use this version here:(https://github.com/protocolbuffers/protobuf/releases/tag/v3.4.0) to avoid errors.Just download the protoc-3.4.0-win32.zip (windows)

Hope that helps.

like image 2
EE_G_RLP Avatar answered Oct 20 '22 20:10

EE_G_RLP