pytorchanaconda3fast-ai

cuda not available when installing fastai or pytorch using anaconda


I want to install fastai package for machine learning tasks. I am using anaconda3 as my package manager. My GPU is NVIDIA GeForce RTX 3050 Ti Laptop GPU. This GPU is listed as cuda compatible on the nvidia cuda compatible list on this website text But when I install the libraries, I always get cuda as not available.

I have tried installing fastai through multiple channels, like,

conda install -c fastchan fastai

conda install -c nvidia fastai anaconda

but every time when I check for cuda availability using

torch.cuda.is_available()

it returns false.

I have also tried installing only pytorch cuda from the official get started locally website text

but even after installing only pytorch using the above command, cuda is still not available.

I have used conda clean command to clear index files and tarballs. The problem still persists.

How do I enable cuda for pytorch, specifically when using it with the fastai library?

Additional information, when using conda list in environment where I installed fastai, pytorch is listed as

pytorch                   1.12.1          cpu_py310h5e1f01c_0

Solution

  • In this or similar cases you have several options:

    1. Clean install supported version of PyTorch with CUDA using instruction from site, check torch.cuda.is_available() and next install new package, by pip install fastai or
    2. Right after your installation, uninstall cpu version of PyTorch and install GPU supported or
    3. (Most complicated) Replace requirements in various setup scripts by your demands. E.g. remove unnecessary conditions or change in setup.py, requirements.txt, different *.ini *.yaml in source code.