概要
このリポジトリ(https://github.com/shabaz/gpu-cpm) をcolabで使おうとしたときにsubprocess-exited-with-errorというエラーが出て、なかなか解決出来なかったので解決法を残しておきます。
エラー文
Processing ./gpu-cpm
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: gpucpm
error: subprocess-exited-with-error
× Building wheel for gpucpm (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Building wheel for gpucpm (pyproject.toml) ... error
ERROR: Failed building wheel for gpucpm
Failed to build gpucpm
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (gpucpm)
解決法
pythonのバージョンが高いことが、原因でした。2025/1/17現在、colabはpython3.11なので、python3.7に変更するとエラーはなくなりました。githubに上がっているコードは、昔のコードが多いので、現在のpythonのバージョンで動かないこともあるようです。
pythonのバージョンの変更はこのサイト (https://qiita.com/kotomiya07/items/c07e1ccce9033d843617) を参考にしました。しかし、この方法でバージョンを変更しても、ipynbで実行されるのは、元のバージョンのため、
!python3.7 example.py
というようにpythonファイルを直接実行しなければなりません。結局は、バージョンを変更する際は、ローカルで実行するのがいいかもしれません。