我正在尝试为一些 ML 工作设置一个 docker 容器,为此我需要 CUDA 和 Conda。我使用以下命令设置 docker 映像:
docker run -it continuumio/anaconda3:2020.11
为了设置 CUDA,我遵循 这些说明。
链接中的步骤是:
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-debian11-11-8-local_11.8.0-520.61.05-1_amd64.deb
dpkg -i cuda-repo-debian11-11-8-local_11.8.0-520.61.05-1_amd64.deb
cp /var/cuda-repo-debian11-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
add-apt-repository contrib
apt-get update
apt-get -y install cuda
但是,当尝试运行
add-apt-repository contrib
时,这些步骤会失败。基于其他线程,我尝试过:
apt-get install software-properties-common
但是,这也失败了:
E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/systemd_241-7~deb10u4_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/systemd-sysv_241-7~deb10u4_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/libpython3.7-minimal_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/python3.7-minimal_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/libpython3.7-stdlib_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
...
如何安装此软件?
我建议您构建一个包含 Anaconda 和 CUDA 的派生映像。似乎有两种明显的方法:
根据一些实验,第二种方法似乎更好。
FROM nvidia/cuda:11.8.0-base-ubuntu22.04
RUN apt-get update && apt-get install -y wget && \
wget -q https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh && \
bash Anaconda3-2020.11-Linux-x86_64.sh -b && \
rm Anaconda3-2020.11-Linux-x86_64.sh
ENV PATH /root/anaconda3/bin:$PATH
# Python packages for testing.
#
RUN conda install -y -q numba cudatoolkit