Reputation: 3443
I have installed cuda along pytorch with
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
However, it seems like nvcc was not installed along with it. If I want to use for example nvcc -V
, I get the error that nvcc was not found, and that I should install it with sudo apt install nvidia-cuda-toolkit.
Can I do this (I dont want to just try and then find out that it is not working/messes up the whole cuda setup).
And is this a bug or expected behavior?
I am using Ubuntu 18.04 and have cuda 10.2
Upvotes: 47
Views: 113207
Reputation: 491
nvidia conda channel is now available: nvidia/cuda and nvcc is in it:
conda install cuda -c nvidia
Upvotes: 24
Reputation: 739
cudatoolkit
that is installed with pytorch is runtime only and does not come with the development compiler nvcc
. To get nvcc
you need to install cudatoolkit-dev
which I believe is available from the conda-forge
channel.
Upvotes: 14
Reputation: 71
cudatoolkit-dev
package from conda-forge
did not work for me. I used the package from HCC
with the latest pytorch (v1.9.0) https://anaconda.org/HCC/cudatoolkit.
The command to install cudatoolkit
alongside pytorch
and torchvision
:
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch -c hcc
After the installation, you can check
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
Upvotes: 7
Reputation: 679
Met this question when installing cudatoolkit
of 10.1 with PyTorch 1.4.
There is a conda-forge
package https://anaconda.org/conda-forge/cudatoolkit-dev
. After installing this, nvcc
as well as other CUDA libraries will be then available at /home/li/anaconda3/envs/<env_name>/pkgs/cuda-toolkit
in bin/
and lib/
.
Upvotes: 37
Reputation: 4479
You can try
conda install -c conda-forge nvcc_linux-64
Currently this should get you 10.2. Nvidia has its own channel nvidia but the latest version there is 10.1.
Upvotes: 6
Reputation: 88
Check if nvcc is in the folder /usr/local/cuda-10.2/bin
Run ./nvcc --version
if it exists in that folder
Output looks like this
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
If this is the case, add the folder to your global path variable
echo "export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}" >> ~/.profile
and refresh the profile using
source ~/.profile
and reboot your machine.
Upvotes: 3