Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue installing CUDA 11 for WSL2 - unmet dependencies #6582

Closed
laurelrr opened this issue Feb 22, 2021 · 4 comments
Closed

Issue installing CUDA 11 for WSL2 - unmet dependencies #6582

laurelrr opened this issue Feb 22, 2021 · 4 comments
Labels

Comments

@laurelrr
Copy link

Environment

Windows build number: [Version 10.0.21318.1000]
Your Distribution version: [Ubuntu 18.04]
Whether the issue is on WSL 2 and/or WSL 1: [WSL2]

Steps to reproduce

I was following the instructions for installing CUDA on WSL2 using the instructions here:
https://medium.com/swlh/how-to-install-the-nvidia-cuda-driver-and-toolkit-in-wsl2-46e2161c91d8
which got me farther than the official instructions on NVIDIA's site.
These are the specific steps:

  1. I upgraded my build to Version 10.0.21318.1000 using the Dev channel of the windows insider program and restarted my computer.
  2. Downloaded and installed the appropriate Nvidia driver for my OS and GPU: 465.42_quadro_win10-dch_64bit_international.exe. This was a clean install - I had removed previous Windows installations of Nvidia software with the Windows uninstaller software before using wsl in powershell.
  3. From PowerShell (run as administrator), checked that I was running wsl version 2. Then:
    > wsl --update
    > wsl --shutdown
    > wsl
    (now I'm running Ubuntu 18.04)
  4. Following Nvidia steps:
    $ sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
    $ sudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list'
    $ sudo apt-get update
    $ sudo apt-get --yes install cuda-toolkit-11-0 cuda-toolkit-10-2

This is where I saw my first dependency errors. It unpacked a bunch of drivers and packages correctly but failed here:
Errors were encoutered while processing:
/tmp/apt-dpkg-install-uLV4X4/05-libnvidia-gl-460_460.32.03-0ubuntu1_amd64.deb
Screenshot 2021-02-22 122605

Initially I tried the suggested 'apt --fix-broken install' but I get the same messages about dependencies.

I tried manually installing the missing files but they won't install due to dependency issues.
sudo apt-get install libnvidia-ifr1-460:amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
libnvidia-ifr1-460 is already the newest version (460.32.03-0ubuntu1).
libnvidia-ifr1-460 set to manually installed.
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-drivers-460 : Depends: libnvidia-gl-460 (>= 460.32.03) but it is not going to be installed
libnvidia-ifr1-460 : Depends: libnvidia-gl-460 but it is not going to be installed
nvidia-driver-460 : Depends: libnvidia-gl-460 (= 460.32.03-0ubuntu1) but it is not going to be installed
Recommends: nvidia-prime (>= 0.8) but it is not going to be installed
Recommends: libnvidia-compute-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
Recommends: libnvidia-decode-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
Recommends: libnvidia-encode-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
Recommends: libnvidia-ifr1-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
Recommends: libnvidia-fbc1-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
Recommends: libnvidia-gl-460:i386 (= 460.32.03-0ubuntu1) but it is not installable
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I tried following the uninstall instructions https://askubuntu.com/questions/940582/upgrade-or-uninstall-cuda-to-allow-apt-get-to-work but was not able to remove the package cleanly due to dependency issues.

'$ sudo dpkg --configure -a'
Setting up libcudnn7 (7.6.5.32-1+cuda10.2) ...
Setting up libnvidia-extra-460:amd64 (460.32.03-0ubuntu1) ...
Setting up libnvidia-common-460 (460.32.03-0ubuntu1) ...
Setting up libcudnn7-dev (7.6.5.32-1+cuda10.2) ...
update-alternatives: using /usr/include/x86_64-linux-gnu/cudnn_v7.h to provide /usr/include/cudnn.h (libcudnn) in auto mode
Setting up libnvidia-fbc1-460:amd64 (460.32.03-0ubuntu1) ...
Setting up nvidia-settings (460.32.03-0ubuntu1) ...
dpkg: dependency problems prevent configuration of libnvidia-ifr1-460:amd64:
libnvidia-ifr1-460:amd64 depends on libnvidia-gl-460; however:
Package libnvidia-gl-460:amd64 is not installed.

dpkg: error processing package libnvidia-ifr1-460:amd64 (--configure):
dependency problems - leaving unconfigured
Setting up libnvidia-compute-460:amd64 (460.32.03-0ubuntu1) ...
Setting up nvidia-kernel-source-460 (460.32.03-0ubuntu1) ...
Setting up nvidia-modprobe (460.32.03-0ubuntu1) ...
Setting up nvidia-utils-460 (460.32.03-0ubuntu1) ...
Setting up nvidia-kernel-common-460 (460.32.03-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)
dpkg: dependency problems prevent configuration of nvidia-driver-460:
nvidia-driver-460 depends on libnvidia-gl-460 (= 460.32.03-0ubuntu1); however:
Package libnvidia-gl-460:amd64 is not installed.
nvidia-driver-460 depends on libnvidia-ifr1-460 (= 460.32.03-0ubuntu1); however:
Package libnvidia-ifr1-460:amd64 is not configured yet.

dpkg: error processing package nvidia-driver-460 (--configure):
dependency problems - leaving unconfigured
Setting up libnvidia-cfg1-460:amd64 (460.32.03-0ubuntu1) ...
dpkg: dependency problems prevent configuration of cuda-drivers-460:
cuda-drivers-460 depends on libnvidia-gl-460 (>= 460.32.03); however:
Package libnvidia-gl-460:amd64 is not installed.
cuda-drivers-460 depends on libnvidia-ifr1-460 (>= 460.32.03); however:
Package libnvidia-ifr1-460:amd64 is not configured yet.
cuda-drivers-460 depends on nvidia-driver-460 (>= 460.32.03); however:
Package nvidia-driver-460 is not configured yet.

dpkg: error processing package cuda-drivers-460 (--configure):
dependency problems - leaving unconfigured
Setting up libnvidia-decode-460:amd64 (460.32.03-0ubuntu1) ...
Setting up nvidia-compute-utils-460 (460.32.03-0ubuntu1) ...
Warning: The home dir /nonexistent you specified can't be accessed: No such file or directory
Adding system user nvidia-persistenced' (UID 111) ... Adding new group nvidia-persistenced' (GID 115) ...
Adding new user nvidia-persistenced' (UID 111) with group nvidia-persistenced' ...
Not creating home directory `/nonexistent'.
Created symlink /etc/systemd/system/multi-user.target.wants/nvidia-persistenced.service → /lib/systemd/system/nvidia-persistenced.service.
dpkg: dependency problems prevent configuration of cuda-drivers:
cuda-drivers depends on cuda-drivers-460 (= 460.32.03-1); however:
Package cuda-drivers-460 is not configured yet.

dpkg: error processing package cuda-drivers (--configure):
dependency problems - leaving unconfigured
Setting up libnvidia-encode-460:amd64 (460.32.03-0ubuntu1) ...
Setting up xserver-xorg-video-nvidia-460 (460.32.03-0ubuntu1) ...
Setting up nvidia-dkms-460 (460.32.03-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)

A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau
from loading. This can be reverted by deleting the following file:
/etc/modprobe.d/nvidia-graphics-drivers.conf

A new initrd image has also been created. To revert, please regenerate your
initrd by running the following command after deleting the modprobe.d file:
/usr/sbin/initramfs -u


*** Reboot your computer and verify that the NVIDIA graphics driver can ***
*** be loaded. ***


Loading new nvidia-460.32.03 DKMS files...
It is likely that 4.4.0-21318-Microsoft belongs to a chroot's host
Building for 4.15.0-134-generic
Building for architecture x86_64
Building initial module for 4.15.0-134-generic
Done.

nvidia:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/4.15.0-134-generic/updates/dkms/

nvidia-modeset.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/4.15.0-134-generic/updates/dkms/

nvidia-drm.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/4.15.0-134-generic/updates/dkms/

nvidia-uvm.ko:
Running module version sanity check.

  • Original module
    • No original module exists within this kernel
  • Installation
    • Installing to /lib/modules/4.15.0-134-generic/updates/dkms/

depmod...

DKMS: install completed.
dpkg: dependency problems prevent configuration of cuda-runtime-10-2:
cuda-runtime-10-2 depends on cuda-drivers (>= 440.33); however:
Package cuda-drivers is not configured yet.

dpkg: error processing package cuda-runtime-10-2 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-demo-suite-10-2:
cuda-demo-suite-10-2 depends on cuda-runtime-10-2; however:
Package cuda-runtime-10-2 is not configured yet.

dpkg: error processing package cuda-demo-suite-10-2 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of cuda-10-2:
cuda-10-2 depends on cuda-runtime-10-2 (>= 10.2.89); however:
Package cuda-runtime-10-2 is not configured yet.
cuda-10-2 depends on cuda-demo-suite-10-2 (>= 10.2.89); however:
Package cuda-demo-suite-10-2 is not configured yet.

dpkg: error processing package cuda-10-2 (--configure):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Processing triggers for initramfs-tools (0.130ubuntu3.11) ...
Errors were encountered while processing:
libnvidia-ifr1-460:amd64
nvidia-driver-460
cuda-drivers-460
cuda-drivers
cuda-runtime-10-2
cuda-demo-suite-10-2
cuda-10-2

WSL logs:

Expected behavior

I expected that I would be able to install CUDA using WSL2 interface.

Actual behavior

I cannot install cuda toolkit due to dependencies that are not going to be installed or are not installable.

@neoblizz
Copy link

neoblizz commented Mar 26, 2021

  • Downloaded and installed the appropriate Nvidia driver for my OS and GPU: 465.42_quadro_win10-dch_64bit_international.exe. This was a clean install - I had removed previous Windows installations of Nvidia software with the Windows uninstaller software before using wsl in powershell.

@laurelrr Did you download the WSL NVIDIA driver, or any NVIDIA driver? I am on 470.14, yours is showing 465.42.
https://developer.nvidia.com/cuda/wsl (Click the "Get CUDA driver" button).

@laurelrr
Copy link
Author

I have since fixed this specific issue by uninstalling and re-installing the same 465.42 driver (restarting) and pointing my /usr/local/cuda -> /usr/local/cuda-11.2.
I believe the underlying issue comes from trying to install docker. It seems to do two things:

  1. pointed my /usr/local/cuda to a symbolic link through /etc/alternatives/cuda -> /usr/local/cuda-11.2
  2. causes me to need to re-run the driver installation and reboot everytime there is some kind of update.
    Although I have tried to completely strip out docker, something seems to reset the driver. Any ideas?

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

@ghost
Copy link

ghost commented Mar 19, 2024

this seems to work for me

# Download CUDA pin file
#wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
#sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600

# Download CUDA repository package
#wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-wsl-ubuntu-12-4-local_12.4.0-1_amd64.deb

'''

# Update package lists
sudo apt update

# Upgrade packages
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt full-upgrade -y

sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo dpkg --configure -

sudo apt update

sudo apt install gcc-12 g++-12 gcc-13 g++-13 -y

sudo dpkg --configure -

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12 --slave /usr/bin/g++ g++ /usr/bin/g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 --slave /usr/bin/g++ g++ /usr/bin/g++-13

sudo dpkg --configure -

sudo update-alternatives --config gcc

sudo dpkg --configure -

gcc --version

sudo apt install build-essential
sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
wget http://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz
#tar -xf gcc-13.2.0.tar.gz

sudo dpkg --configure -

cd gcc-13.2.0

sudo dpkg --configure -

./configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-13.2.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-13.2.0

sudo dpkg --configure -

make -j3
sudo make install

sudo dpkg --configure -

/usr/local/gcc-13.2.0/bin/gcc-13.2.0 --version

sudo dpkg --configure -

# Install required packages
sudo apt install -y \
    libxkbcommon0=1.6.0-1 \
    fakeroot \
    libalgorithm-merge-perl \
    g++=4:13.2.0-7 \
    cpp-x86-64-linux-gnu=4:13.2.0-7 \
    g++-13>=13.2.0-11 \
    g++-x86-64-linux-gnu=4:13.2.0-7 \
    gcc-13>=13.2.0-11 \
    gcc=4:13.2.0-7 \
    gcc-x86-64-linux-gnu=4:13.2.0-7 \
    libglvnd0=1.7.0-1 \
    lto-disabled-list \
    openjdk-17-jre-headless=17.0.10+7-1~22.04.1 \
    libatk-wrapper-java-jni>=0.30.4-0ubuntu2 \
    cpp=4:13.2.0-7 \
    cpp-x86-64-linux-gnu=4:13.2.0-7 \
    g++-13>=13.2.0-11~ \
    g++-x86-64-linux-gnu=4:13.2.0-7 \ 
    gcc-13>=13.2.0-11~ \
    gcc=4:13.2.0-7 \
    cpp-x86-64-linux-gnu=4:13.2.0-7 \ 
    gcc-13>=13.2.0-11~ \
    gcc-x86-64-linux-gnu=4:13.2.0-7 \ 
    openjdk-17-jre-headless=17.0.10+7-1~22.04.1 \
    libatk-wrapper-java-jni>=0.30.4-0ubuntu2

'''

# Install CUDA repository
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.0-1_amd64

# Copy CUDA keyring
sudo cp /var/cuda-repo-wsl-ubuntu-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/

# Update package lists
sudo apt-get update

# Install CUDA toolkit
sudo apt-get -y install cuda-toolkit-12-4

# Install pycuda (optional)
#sudo pip3 install pycuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants