This gist is a note about install nvidia-docker
in Pop!_OS 20.10
. nvidia-docker
is used to help docker containers compute on GPU.
The basic installcation is in Nvidia's offical documentation. But there are a few tweaks to make it work on Pop!_OS 20.10
.
No surprise. Follow the offical documentaion should work.
Pop!_OS
is an "Unsupported distribution" in Nvidia source. Also, Ubuntu 20.10
are not supported by Nvidia source yet. So we need to change the distribution into ubuntu20.04
when adding sources. For instacne,
distribution="ubuntu20.04" \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
Reference:
While installing nvidia-docker2
, I got the following error
(base) ➜ ~ sudo apt-get install -y nvidia-docker2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nvidia-docker2 : Depends: nvidia-container-runtime (>= 3.5.0) but 3.4.0-1pop1~1601325114~20.10~2880fc6 is to be installed
E: Unable to correct problems, you have held broken packages.
It is because Pop!_OS
's own source for Nvidia driver has high priority than Nvidia's offical source. But the dependencies for nvidia-docker2
falls behind to Nvidia's offical source. To fix that, we could give nvdia docker source a higher priority as folllows.
vi /etc/apt/preferences.d/nvidia-docker-pin-1002
with content;
Package: *
Pin: origin nvidia.github.io
Pin-Priority: 1002
Then follow the offical documentation by running the following command. We will launch a container with GPU.
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
Reference:
@VitalyyBezuglyj Thanks for the feedback. I have updated my gist accordingly. Happy coding!