When I run conda install tensorflow-gpu in a new venv, conda gives the list of packages that it will install, but there are no CUDNN or cudatoolkit packages which I would expect, and that other people have. I am expecting an output like in this question (Is it still necessary to install CUDA before using the conda tensorflow-gpu package?
) but instead I get this:
Edit: I was able to get it to work by running this command instead
conda create -n tf-gpu python=3.7 anaconda followed by
conda install tensorflow-gpu
After doing this it installed all the cudnn libraries on its own and I was able to run tensorflow with GPU. However, for some reason it is installing tensorflow 1.14, and I need 2.x so does anyone know why this is?
conda install tensorflow-gpu install only gpu version of Tensorflow and not supporting packages such as CUDA and cuDNN.
Follow steps to install
conda install cudatoolkit=10.0.130
conda install cudnn=7.6.0=cuda10.0_0
conda install tensorflow-gpu
Related
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.
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>.
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
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.
I have Anaconda under Windows 8.1, Python 3.7 e TensorFlow 1.14. I tried some pip commands but the 1.14 is the only version installed of TensorFlow.
There are other ways to update, for example, version 1.5 ?
Thank a lot for any help!
Tensorflow 1.14 is the latest release for the time being. If you wanna install a specific version
conda install tensorflow=1.5.0
The problem is that tensorflow 1.5 is not compatible with Python 3.7 before 1.13.0rc1.
If you need version 1.5.0, you need to create a virtual environment with Python 3.6 using conda.
conda create -n py36 python=3.6
conda activate py36
conda install tensorflow=1.5.0
# you can also install tensorflow using pip
# choose the package manager you want
conda install tensorflow==1.5.0
Note: Don't use pip and conda to install pkg at the same time in one environment. Check Using Pip in a Conda Environment for more info.
In conda the latest version of conda is:
cudnn 7.3.1 cuda10.0_0 anaconda
But i need 7.4.2 for tensorflow-gpu.1.13
How install cuDNN==7.4.2 in conda?
conda update --force conda
conda update conda
conda install -c anaconda cudnn
conda list cudnn
You can install with conda-forge
conda install -c conda-forge cudnn
https://anaconda.org/conda-forge/cudnn
It is more up to date than anaconda channel - for example as of today, latest version of cudnn on anaconda is still 7.6.5, but on conda-forge v8.2.0.53.
Same applies to cudatoolkit package.
You need to uninstall cudnn: conda uninstall cudnn.
Uninstall any tensorflow dependencies: "conda uninstall tensorflow"
Install tensorflow using pip: "pip install tensorflow"
Install CuDNN and Cuda ToolKit following the instructions in here: https://www.tensorflow.org/install/gpu#linux_setup
Use PyCharm or Spyder to run Scripts using tensorflow
The best use is to install both cuda-toolkit and CuDNN using conda environment for the best compatibility. But in some cases people might need the latest version. Moreover sometimes cuda packages are updated in different schedules such as the time being this answer is provided, conda provides cudatoolkit-11.0 but cant provide CuDNN-8.0 at the same time. which happened in my case. 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.
sudo cp cuda/include/cudnn*.h /anaconda3/envs/<your environment here>/include
sudo cp cuda/lib64/libcudnn* /anaconda3/envs/<your environment here>/lib
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /anaconda3/envs/<your environment here>/lib/libcudnn*
In the given snipped "cuda" path represent the unzipped CuDNN folder. This workaround is tested with tensorflow-2.4 & cudatoolkit-11.0 & CuDNN 8.0.4
This is how i installed cudnn.
1. You can download cudnn tar file of a version which you want from NVIDIA and extract it.
Then, you can see "cuda" folder including cudnn files.
2. Copy and paste the cudnn files to conda envs lib and include folder:
sudo cp cuda/include/cudnn*.h anaconda3/envs/"your_env_name"/include
sudo cp cuda/lib64/libcudnn* anaconda3/envs/"your_env_name"/lib
anaconda3 is your anaconda installation folder.
In my case, it worked.
This was not possible to do it with conda at the time the question was made. That is way it was suggested to try this. However, now it is possible. Follow the other answers
When I run :
pip install --upgrade tensorflow
This message pops up:
could not find the version that satisfies the requirement tensorflow
what should I do?
This is probably happening because you are using a pip version below 8.3.
In that case, you can install tensorflow using
For CPU version - pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.7.0-cp27-none-linux_x86_64.whl
For GPU version - pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.7.0-cp27-none-linux_x86_64.whl
These binaries are for version 1.7 and Python 2.7. You can get the latest wheel URLs from the official installation guide.
This worked for me
conda install pip
python -m pip install --upgrade pip
pip install --ignore-installed --upgrade tensorflow
This is what worked for me on Windows 10. Currently, Tensorflow only works with 64-bit windows, not 32-bit. So, you could create a new 64-bit environment and install tensorflow in it:
set CONDA_FORCE_32BIT=
conda create --name name_of_your_created_environment python=3.5
activate name_of_your_created_environment
conda install -c conda-forge tensorflow
Note:
CONDA_FORCE_32BIT=1 sets to a 32-bit environment whilst CONDA_FORCE_32BIT= sets to a 64-bit environment.
I tried to install tensorflow with following steps:
conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow-gpu
As soon as I installed, conda shuts down immediately. I am using 64 bit windows and Anaconda 3.5. Please help
You should use conda to install tensorflow. Pip often causes problems.
conda install -c conda-forge tensorflow
Have a look to these steps to install first CPU version: Permission denied when installing Tensorflow