Skip to content

Instantly share code, notes, and snippets.

@WebSofter
Last active November 12, 2024 03:11
Show Gist options
  • Save WebSofter/110faa5f552d0414693534314c99b126 to your computer and use it in GitHub Desktop.
Save WebSofter/110faa5f552d0414693534314c99b126 to your computer and use it in GitHub Desktop.
PyTorch CUDA is not available problem on Ubuntu Desktop
### VARIANT 1
#Run command
sudo nvidia-settings
#Ant check getting error: "ERROR: NVIDIA driver is not loaded"
#Your next steps:
sudo prime-select intel
sudo reboot
sudo prime-select nvidia
sudo reboot
#Сheck again by command:
sudo nvidia-settings
#Now you should not get an error!!!
### VARIANT 2
# First install NVIDIA CUDA Toolkit provided by Canonical(https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network):
sudo apt install -y nvidia-cuda-toolkit
# or follow NVIDIA developers instructions(https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_network):
# ENVARS ADDED **ONLY FOR READABILITY**
NVIDIA_CUDA_PPA=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/
NVIDIA_CUDA_PREFERENCES=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
NVIDIA_CUDA_PUBKEY=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
# Add NVIDIA Developers 3rd-Party PPA
sudo wget ${NVIDIA_CUDA_PREFERENCES} -O /etc/apt/preferences.d/nvidia-cuda
sudo apt-key adv --fetch-keys ${NVIDIA_CUDA_PUBKEY}
echo "deb ${NVIDIA_CUDA_PPA} /" | sudo tee /etc/apt/sources.list.d/nvidia-cuda.list
# Install development tools
sudo apt update
sudo apt install -y cuda
ERROR: NVIDIA driver is not loaded
(nvidia-settings:61388): GLib-GObject-CRITICAL **: 20:45:45.228: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** (nvidia-settings:61388): CRITICAL **: 20:45:45.232: ctk_powermode_new: assertion '(ctrl_target != NULL) && (ctrl_target->h != NULL)' failed
ERROR: nvidia-settings could not find the registry key file or the X server is not accessible. This file should have been installed along with this driver at
/usr/share/nvidia/nvidia-application-profiles-key-documentation. The application profiles will continue to work, but values cannot be prepopulated or validated, and
will not be listed in the help text. Please see the README for possible values and descriptions.
** Message: 20:45:45.295: PRIME: No offloading required. Abort
** Message: 20:45:45.296: PRIME: is it supported? no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment