Nvcc missing when installing cudatoolkit?
Solution 1
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/
.
Solution 2
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.
Solution 3
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.
Solution 4
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
Related videos on Youtube
Luca Thiede
Updated on December 08, 2021Comments
-
Luca Thiede over 2 years
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 withsudo 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
-
Robert Crovella almost 5 yearsThe
cudatoolkit
installed usingconda install
is not the same as the CUDA toolkit packaged up by NVIDIA. It is a subset, to provide the needed components for other packages installed byconda
such aspytorch
. It's likely that it is all you need if you only need to use pytorch. If you need/want the full CUDA toolkit for some other reason, you can install it using a variety of methods including some variant of the one you indicate, but it will install a separate copy, in another location from what is typically used by conda packages. This all looks like expected behavior to me. -
Robert Crovella almost 5 yearsNVIDIA publishes a CUDA linux install guide which may be useful. It doesn't have conda packages or methods in view, however.
-
Robert Crovella almost 5 yearsYou haven't mentioned if you have a GPU, or what GPU you have, or if you installed a GPU driver, or what GPU driver you installed, but that is all important. The simplest instruction for compatibility is to install the latest driver for your GPU, if you've not already done so. Installing a CUDA toolkit from NVIDIA may install a proper/sufficient driver for you, depending on what exactly you install. Generally,
conda install ...
does not install a GPU driver, in my experience. -
Luca Thiede almost 5 yearsAn Faster-RCNN implementation I want to use needs nvcc. I do have a gpu, and Pytorch runs flawless otherwise. So the safest bet is to uninistall the conda cudatoolkit and install cuda manually? Do you know of any good installlation script that automates the installation?
-
Robert Crovella almost 5 yearsI think you will discover that it is harder to get your conda install of pytorch to use a CUDA toolkit other than the one installed by conda. I don't know what the safest bet is; I regularly use a machine that has the cuda toolkit installed by conda and a separate install that I did using the instructions I already provided. That may or may not work for your use case. Versions do matter. Requests for tutorials, scripts, off-site resources are generally off-topic for stack overflow, from what I have seen.
-
-
Bo Li about 4 yearsFollowed this answer but found out that this seems not solving the problems. The nvcc installed by
nvcc_linux-64
is merely a shell script calling$(CUDA_HOME)/bin/nvcc
-
tejasvi88 almost 4 yearsUnfortunately, it currently has 10.1 and I need 10.2
-
Bo Li almost 4 years@tejasvi88 try requesting this by github.com/conda-forge/cudatoolkit-dev-feedstock
-
stason about 3 yearsas it say in the description of the package: "A meta-package to enable the right nvcc." not really nvcc
-
Wok about 3 yearsThank you so much! I was going crazy!
-
Wok about 3 yearsPeople, listen to the guys above my comment: this does NOT install nvcc! It is like a shortcut to nowhere! You will waste time figuring out what is wrong when you don't have nvcc in the first place!
-
inverted_index almost 3 yearsStrange why it doesn't have version 10.2 :/
-
Sterling over 2 yearsLooks like this is also only for Linux
-
Fazil over 2 years@Sterling I haven't tested the commands on a Windows machine. So, probably it is only for Linux.
-
Fazil over 2 yearsJust checked
cudatoolkit
package on HCC repo. HCC providescudatoolkit
package only for Linux. -
Rafay Khan over 2 yearsGets stuck on "Executing transaction" and then eventually fails :/
-
Rafay Khan over 2 yearsActually, worked for me. Thanks!
-
Juergen over 2 yearsFrom the Nvidia website ( link ), I see that CUDA packages can be installed selectively. Is it sufficient to only install nvcc?
-
Deep Patel over 2 yearsI haven't tried with selective install but seems okay since the nvcc installation will check for any dependencies beforehand