Install nvidia drivers / cuda to support pytorch - needs cuda11.7 / 11.8

Is there a good guide / script anywhere to intall older versions of nvidia drivers / cuda on Fedora?

I need to install cuda 11.7 or cuda 11.8 (with appropriate nviidia driver version).

All the info I can find just installs latest drivers / cuda and pytorch falls in a heap

Background:
After messy problems with nvidia drivers at the end of last yar, I ran up an ubuntu install and setup pytorch with cuda 11.7 and nvidia drivers 515 (pytorch is very particular about cuda versions!), but I want to update that partition now to Fedora 38 (I also have Fedora 37 on another partition on my laptop)

In case its relevant: its an asus rog laptop with AMD Ryzen™ 7 5800H and nvidia 3060gpu

1 Like

I am not sure what your issue is.
I have fedora 37 and fedora 38. Both with nvidia GPUs and both with the latest nvidia (530.41.03) and cuda (12.1) from rpmfusion.

Using the command given on the pytorch site – (pip3 install torch torchvision torchaudio) to do the install as my regular user I did the install of pytorch. Doing so it installed the runtime for cuda 11.7 during the install and properly completed the install. I also already had several of the necessary packages that would have been pulled in previously installed.
Note that wheel is one of the requisites that should be installed, and probably system wide with dnf install python3-wheel, though it can also be installed at the user level with pip install wheel.

Building wheels for collected packages: lit
  Building wheel for lit (setup.py) ... done
  Created wheel for lit: filename=lit-16.0.2-py3-none-any.whl size=88174 sha256=2e73d4a9bde7bc1d9342518fea107594d5ea37c1cb19d82221ce1f81d3add066
  Stored in directory: /home/USER/.cache/pip/wheels/fb/a8/04/72bc6a1756fb8716328752892dc4cc253e2d9a01dbcd3c0543
Successfully built lit
Installing collected packages: mpmath, lit, cmake, typing-extensions, sympy, nvidia-nvtx-cu11, nvidia-nccl-cu11, nvidia-cusparse-cu11, nvidia-curand-cu11, nvidia-cufft-cu11, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cuda-cupti-cu11, nvidia-cublas-cu11, networkx, jinja2, filelock, nvidia-cusolver-cu11, nvidia-cudnn-cu11, triton, torch, torchvision, torchaudio
Successfully installed cmake-3.26.3 filelock-3.12.0 jinja2-3.1.2 lit-16.0.2 mpmath-1.3.0 networkx-3.1 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 sympy-1.11.1 torch-2.0.0 torchaudio-2.0.1 torchvision-0.15.1 triton-2.0.0 typing-extensions-4.5.0

I also did the verification test properly.

$ cat torchtest.py 

import torch
x = torch.rand(5, 3)
print(x)



$ python torchtest.py 
tensor([[0.8762, 0.4845, 0.0485],
        [0.1443, 0.4145, 0.0638],
        [0.0959, 0.4716, 0.5804],
        [0.1758, 0.7861, 0.9566],
        [0.1510, 0.1411, 0.4047]])

Ah! thanks, my bad, I assumed I had to arrange that the right version of cuda was already installed. I’ll give that a go

Ah, yes.
Make sure you install it as your user and not system wide to avoid problems with cuda for the system. As a user install it remains only when run as part of that environment and does not impact the system overall.

1 Like