How to properly set up an conda environment with PyTorch

I want to use PyTorch with cuda support, and here is what I am usually doing when starting a new project:

conda create -n ‘myproject’
conda activate ‘myproject’

Then, in order to install PyTorch, I go to the site

and choose what I require:

Stable, Linux, Conda, Python, Cuda 11.8 (I got a 4090, and with 11.7 it was somehow slow). I copy paste the command and install everything. Is this the correct way? Am I missing something?

Because, with that approach I just got the error :
Could not load library libcudnn_cnn_infer.so.8. Error: libnvrtc.so: cannot open shared object file: No such file or directory

Do I still need to install the nvidia cuda toolkit ?

Your workflow is correct and you are running into this issue. You could apply a workaround by creating the missing symbolic link as described here.

Thanks! But it is actually recommended to use cuda 11.8 instead of 11.7 for the 4090?

Yes, as the CUDA 11.8 builds ship with a newer cuDNN version (8.7) and added the heuristics for your 4090. Older GPUs should not see a huge difference.

1 Like