LoginSignup
10
1

More than 1 year has passed since last update.

NVIDIAのおかげでGPU版Kaggle Dockerの再構築でGWの一日を溶かした

Posted at

0.Intro

GWに入ったので機械学習の勉強に専念できると思いきや色々問題があってKaggle Dockerを再構築しようとしました。前回の構築から半年以上経っていたので丁度いいかなと思い

./build --gpu

とすると途中で止まる。
エラーは以下のような感じ。

W: GPG error: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC
E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64  InRelease' is not signed.

色々調べた結果、
Updating the CUDA Linux GPG Repository Key
とのこと。
本家がこのタイミングでセキュリティの強化という非常にご尤もなことをなさったので起きているエラーでした。

色々調べた結果回避策は以下のようになりました。

1.手順

まず

./build --gpu

を走らせる。

すると配下に生成される

docker-python/.generate/gpu.Dockerfile

をコピー

gpu.Dockerfileの27行目辺りに
以下を追記

RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80
RUN apt-get update && apt-get install -y --no-install-recommends wget
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
RUN dpkg -i cuda-keyring_1.0-1_all.deb

※本家の記事にもあるようにwgetするOSとarchは適宜変更してください。

次に実行するシェルbuildを編集

末尾を

docker build --rm --pull $CACHE_FLAG -t "$IMAGE_TAG" -f gpu.Dockerfile $BUILD_ARGS .

と変更して下さい。
末尾のすぐ上を見てもらうと分かるように、buildは最新のDockerfileをとってきてオプションの設定を反映させる為に書き換えた結果を実行するためです。
ですのでオプションを設定を反映後のDockerfileに対して今回の回避策をコードを追加する必要があります。

これで

./build --gpu

を実行すると冒頭のエラーを回避できます。
僕のように貴重なGWの一日を溶かす人が一人でも少なくなればと思い記事にしました。

10
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
1