问题遇到的现象和发生背景
在pytorch环境中安装compressai,报错 Building editable for compressai (pyproject.toml) did not run successfully.
用代码块功能插入代码,请勿粘贴截图
使用的代码是
cd compressai
pip install -e .
运行结果及报错内容
Building editable for compressai (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building editable for compressai (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
running editable_wheel
creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info
writing C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\PKG-INFO
writing dependency_links to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\dependency_links.txt
writing requirements to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\requires.txt
writing top-level names to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\top_level.txt
writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\SOURCES.txt'
reading manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai.egg-info\SOURCES.txt'
creating 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai-1.2.1.dist-info'
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\wheel\bdist_wheel.py:80: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
if get_flag('Py_DEBUG',
creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-585ofzy1\tmp__12frym\compressai-1.2.1.dist-info\WHEEL
running build_py
running build_ext
building 'compressai.ans' extension
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 140, in run
self._create_wheel_file(bdist_wheel)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 330, in _create_wheel_file
files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 261, in _run_build_commands
self._run_build_subcommands()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 288, in _run_build_subcommands
self.run_command(name)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
super().run_command(command)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command
cmd_obj.run()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
_build_ext.run(self)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 346, in run
self.build_extensions()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\pybind11\setup_helpers.py", line 290, in build_extensions
super().build_extensions()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 466, in build_extensions
self._build_extensions_serial()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 492, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 547, in build_extension
objects = self.compiler.compile(
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 344, in compile
self.initialize()
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\msvc.py", line 214, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-48vszt32\overlay\Lib\site-packages\setuptools\msvc.py", line 168, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
error: Support for editable installs via PEP 660 was recently introduced
in setuptools
. If you are seeing this error, please report to:
https://github.com/pypa/setuptools/issues
Meanwhile you can try the legacy behavior by setting an
environment variable and trying to install again:
SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building editable for compressai
Failed to build compressai
ERROR: Could not build wheels for compressai, which is required to install pyproject.toml-based projects
我的解答思路和尝试过的方法
重建了一个pytorch环境,并且将setuptools更新了之后还是不可以。
我想要达到的结果
希望可以成功安装compressai