考虑一下通常的场景--我想要创建一个虚拟环境并安装一些软件包。说
python3 -m venv venv
source venv/bin/activate
pip install databricks-cli在安装过程中,我收到一个错误
Building wheels for collected packages: databricks-cli
Building wheel for databricks-cli (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/paulius/Documents/wheeltest/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"'; __file__='"'"'/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-maxix98x
cwd: /tmp/pip-install-m7jmyh1m/databricks-cli/
Complete output (8 lines):
/tmp/pip-install-m7jmyh1m/databricks-cli/setup.py:24: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for databricks-cli虽然它是良性的(实际安装是有效的),但仍然很烦人。
我知道pip install wheel解决了这个问题,但是默认情况下,wheel并不会附带虚拟环境。所以,我应该总是将它添加到我的requirements.txt中,或者这可能是包维护人员可以解决的问题(在本例中是databricks-cli),因此我应该在它们的Github中打开一个问题?
Update:请注意,安装车轮并不需要wheel,在本例中,许多依赖项被成功下载并作为轮子安装。唯一的databricks包会得到错误,因为它没有轮子,但是出于某种原因,pip试图构建它。
发布于 2021-07-14 12:29:11
这是一个pip错误,解决方案是升级pip。最新版本的东西看上去很好:
(venv) paulius@xps:~/Documents/wheeltest$ pip install databricks-cli
Collecting databricks-cli
Using cached databricks-cli-0.14.3.tar.gz (54 kB)
Collecting click>=6.7
Using cached click-8.0.1-py3-none-any.whl (97 kB)
Collecting requests>=2.17.3
Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting six>=1.10.0
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting tabulate>=0.7.7
Using cached tabulate-0.8.9-py3-none-any.whl (25 kB)
Collecting idna<4,>=2.5
Using cached idna-3.2-py3-none-any.whl (59 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2021.5.30-py2.py3-none-any.whl (145 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.6-py2.py3-none-any.whl (138 kB)
Collecting charset-normalizer~=2.0.0
Using cached charset_normalizer-2.0.1-py3-none-any.whl (35 kB)
Using legacy 'setup.py install' for databricks-cli, since package 'wheel' is not installed.
Installing collected packages: urllib3, idna, charset-normalizer, certifi, tabulate, six, requests, click, databricks-cli
Running setup.py install for databricks-cli ... done
Successfully installed certifi-2021.5.30 charset-normalizer-2.0.1 click-8.0.1 databricks-cli-0.14.3 idna-3.2 requests-2.26.0 six-1.16.0 tabulate-0.8.9 urllib3-1.26.6注意Using legacy 'setup.py install' ...行。
这是pip https://github.com/pypa/pip/issues/8302中的一个相关问题。不完全是这样,但在评论中有一个解释,那就是车轮建造逻辑应该是什么。
发布于 2021-07-14 09:10:13
更新3:
为了防止从维护者的角度来看,请使用:
setup_requires=["wheel"]它看起来像是在Linux上使用预装或修改过的Python及其setuptools。
我也经历过同样的事情,因为Debian以一种不完全正常的方式切断了包的部分,而且我主要遇到了预构建的python-setuptools和issues的问题。检查版本是否匹配,如果不匹配,请从pip中安装setuptools,这在将来可能会有所帮助。
我有setuptools 45.2.0,没有问题,把包作为一个轮子安装。然后,我卸载了轮子,丢弃了缓存dir,它甚至从来源正确地安装了它。
更新2:
它可能通过需要wheel包来解决,也可能无法解决。如果setup.py希望bdist_wheel在安装之前出现(很有可能),将其添加到setup()函数将不会有帮助,并且需要手动检查安装脚本中的包(在自述中可能是一个引用),以便最终用户能够正确安装它。
例如,如果它不在系统中,只需打印一个警告并调用一个exit()。这是维护人员应该做的最起码的事情。
更新:
是的,在遇到缺少bdist_wheel命令的情况下,您需要使用pip instal wheel安装轮子。
这不是必需的,但这是推荐的。Pip在没有轮子的情况下可以正常工作,但是您将从源代码(tar.gz、.zip或.egg)安装。
有关是否使用轮毂或鸡蛋(或源),请参见包装讨论。
https://stackoverflow.com/questions/68375133
复制相似问题