How to update from CPU only install to CUDA install?

Hi All,

A bit of a stupid question but how can I upgrade from my CPU only install to one that has CUDA? I did read this question here but it hasn’t worked.

I ran the following command to update to pytorch with CUDA support: conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidia but when I tried to see if cuda is available it doesn’t appear. I.e,

torch.cuda.is_available() #returns False

I even uninstalled all of pytorch AND anaconda itself, yet to reinstall anaconda but pytorch stills exist in a CPU-only state. I’m sure I’m doing something really stupid but any help would be greatly appreciated!

Thank you!

Could you create a new conda environment and reinstall the PyTorch binary with cudatoolkit? During the installation check the log / terminal output and make sure that the CUDA version is indeed selected and installed.
If the GPU still cannot be used, check that you have recent NVIDIA drivers installed on your machine.

1 Like

Hi @ptrblck!

I’ve managed to get it all working! The only issue I can is that I’m using Python with conda yet python seems to be using my pip install of PyTorch. For example, when I installed it via conda it found conflicts and wouldn’t detect my GPu at all (via torch.cuda.is_available()), but when I installed via pip. It worked and detect my GPU. A little bit strange to me!

Is it advisable to run PyTorch from conda rather than pip?

Thank you! :slight_smile:

I don’t think so and it depends on your workflow. While I’m using conda to manage my environments, I’m installing a lot of different conda, pip, and source builds into them to test and debug different setups.
I also make sure that my base environment in coda is “clean”, i.e. no additional packages are installed there to avoid any conflicts.
I’m also sure that others prefer to use pip more and have valid reasons for it. :wink:

Well, the only reason I’m using pip is because python seems to default to it even though Python says it’s using Anaconda! :sweat_smile: I assume this is because I’m defaulting to pip even though the Python interpreter says in using Anaconda in the start-up when I use python3 via command line?