Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers . If you believe the question would be on-topic on another Stack Exchange site , you can leave a comment to explain where the question may be able to be answered.

Closed 10 months ago .

This post was edited and submitted for review 10 months ago and failed to reopen the post:

Original close reason(s) were not resolved

I am using ubuntu 22 LTS. I want to use a different version of Cuda in the conda virtual environment. I want to use a virtual conda environment for tensorflow 1.x and another conda env for tensorflow 2.x and one environment for PyTorch. I add the version of Cuda when I created the environment. My problem is that instead of using the Cuda that is installed in the conda env (ie. conda create -n tf1 cudnn=7.6.5 cudatoolkit=10.1.243 ), it uses the system cuda. when I type the

nvcc --version

the output is:

nvcc: NVIDIA (R) Cuda compiler driver
Built on Tue_May__3_18:49:52_PDT_2022
Cuda compilation tools, release 11.7, V11.7.64
Build cuda_11.7.r11.7/compiler.31294372_0

how can I set the path to use the specific Cuda version installed in the environment and not the system?

You can set the CUDA_HOME environment variable with this command.

conda env config vars set CUDA_HOME=""

You should be able to use this command to find the path of your conda-installed CUDA library.

sudo find / -name nvcc

You might also want to look at this documentation to have environment variables set as part of the activation step.

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables

thank u for your answer. However, I haven't installed cuda-nvcc in the env . I have installed cudatoolkit and cudnn via conda. is there another way to find the path of cuda in the conda env? – homa taha Jun 20, 2022 at 16:45 So I just tried this on a fresh instance, and found that I had to install cuda-nvcc as well. I wonder if the issue is that cudatoolkit and cudnn aren't install cuda-nvcc and thus aren't providing an alternative path when the conda env is activated. – peytoncas Jun 20, 2022 at 18:40