ITADN

KeyError: 'scm_version' during installation

#178Openmatbun 创建于 2025-08-04
bug
M
matbuncommented
<!-- Feel free to change the order of sections if appropriate. --> **Describe the bug** I had to explicitly set `GPUSTAT_VERSION` to bypass the execution of the `read_version` [function](https://github.com/wookayin/gpustat/blob/7a3b9644229681a752b560c6d4889929b9ea39d5/setup.py#L37). I am wondering whether this is the intended behaviour and whether maybe a pyproject.toml + conforming to more recent build tooling may help. **Screenshots or Program Output** ```bash matbun@mylaptop$ docker run -it --rm python:3.12 bash root@f528d76dbdd3:/# pip install gpustat==1.1.1 Collecting gpustat==1.1.1 Downloading gpustat-1.1.1.tar.gz (98 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [26 lines of output] Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 37, in <module> File "<string>", line 26, in read_version File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools_scm/_integration/dump_version.py", line 77, in dump_version write_version_to_path( File "/tmp/pip-build-env-g44nh1xn/overlay/lib/python3.12/site-packages/setuptools_scm/_integration/dump_version.py", line 111, in write_version_to_path content = final_template.format(version=version, version_tuple=version_tuple) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'scm_version' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. [notice] A new release of pip is available: 25.0.1 -> 25.2 [notice] To update, run: pip install --upgrade pip error: subprocess-exited-with-error × Getting requirements to build wheel 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. root@f528d76dbdd3:/# export GPUSTAT_VERSION=1.1.1 root@f528d76dbdd3:/# pip install gpustat==1.1.1 Collecting gpustat==1.1.1 Using cached gpustat-1.1.1.tar.gz (98 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting nvidia-ml-py>=11.450.129 (from gpustat==1.1.1) Downloading nvidia_ml_py-12.575.51-py3-none-any.whl.metadata (9.3 kB) Collecting psutil>=5.6.0 (from gpustat==1.1.1) Downloading psutil-7.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB) Collecting blessed>=1.17.1 (from gpustat==1.1.1) Downloading blessed-1.21.0-py2.py3-none-any.whl.metadata (13 kB) Collecting wcwidth>=0.1.4 (from blessed>=1.17.1->gpustat==1.1.1) Downloading wcwidth-0.2.13-py2.py3-none-any.whl.metadata (14 kB) Downloading blessed-1.21.0-py2.py3-none-any.whl (84 kB) Downloading nvidia_ml_py-12.575.51-py3-none-any.whl (47 kB) Downloading psutil-7.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (277 kB) Downloading wcwidth-0.2.13-py2.py3-none-any.whl (34 kB) Building wheels for collected packages: gpustat Building wheel for gpustat (pyproject.toml) ... done Created wheel for gpustat: filename=gpustat-1.1.1-py3-none-any.whl size=26535 sha256=f94147fe2320ff0e532d39ad7373e088d8cd8e944fee5ccb55846a6583069060 Stored in directory: /root/.cache/pip/wheels/b0/11/1f/d78086f1f4693c23c6dc261e4f7da46bf3a9eb0717f2fb28b9 Successfully built gpustat Installing collected packages: wcwidth, nvidia-ml-py, psutil, blessed, gpustat Successfully installed blessed-1.21.0 gpustat-1.1.1 nvidia-ml-py-12.575.51 psutil-7.0.0 wcwidth-0.2.13 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. [notice] A new release of pip is available: 25.0.1 -> 25.2 [notice] To update, run: pip install --upgrade pip root@f528d76dbdd3:/# ``` **Environment information:** ```bash root@f528d76dbdd3:/# cat /etc/*-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@f528d76dbdd3:/# python --version Python 3.12.11 ```
1 条评论