psa*_*rka 13 python pip python-wheel
考虑通常的场景 - 我想创建一个虚拟环境并安装一些软件包。说
python3 -m venv venv
source venv/bin/activate
pip install databricks-cli
Run Code Online (Sandbox Code Playgroud)
在安装过程中,我收到错误
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
Run Code Online (Sandbox Code Playgroud)
虽然它是良性的(安装实际上有效),但它仍然很烦人。
我知道这pip install wheel可以解决这个问题,但wheel默认情况下虚拟环境并不附带。那么我应该总是将它添加到我的requirements.txt中,或者也许这是包维护者可以解决的问题(在本例中databricks-cli),因此我应该在他们的Github中打开一个问题?
更新:请注意,wheel没有必要安装轮子,在此示例中,一堆依赖项已成功下载并安装为轮子。唯一的 databricks-cli 包出现错误,因为它没有轮子,但由于某种原因,pip 尝试构建它。
更新3:
为了从维护者的角度防止它使用:
setup_requires=["wheel"]
Run Code Online (Sandbox Code Playgroud)
看起来您在 Linux 上并使用预安装或以其他方式修改的 Python 及其setuptools.
我也经历过同样的事情,因为 Debian 以不太理智的方式切断了部分软件包,而且我主要遇到了预构建python-setuptools和喜欢的问题。检查版本是否匹配,如果不匹配,请从 pip 安装 setuptools,这可能会在将来有所帮助。
我有安装工具45.2.0,并且将软件包安装为轮子时没有任何问题。然后我卸载了wheel并删除了缓存目录,甚至从源代码也tar.gz正确安装了它。
更新2:
它可能会也可能不会通过要求wheel包来解决。如果setup.py期望bdist_wheel在安装之前出现(最有可能),则将其添加到函数中setup()不会有帮助,并且需要在安装脚本中手动检查包(+可能是自述文件中的参考),以便最终用户可以正确安装。
例如,如果系统上不存在它,只需打印警告并调用exit(). 这是维护者至少应该做的。
更新:
是的,如果您遇到bdist_wheel命令丢失的情况,您需要使用pip instal wheel.
这不是必需的,但建议这样做。Pip 在没有轮子的情况下也能正常工作,但您将从源代码(tar.gz、.zip或.egg)安装。
请参阅包装讨论以了解是否使用wheel或egg(或source)。
这是一个 pip bug,解决方案是升级 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
Run Code Online (Sandbox Code Playgroud)
注意该Using legacy 'setup.py install' ...线。
这是 pip github https://github.com/pypa/pip/issues/8302中的相关问题。不完全是这样,但是评论中有关于轮子构建逻辑的解释。
| 归档时间: |
|
| 查看次数: |
5499 次 |
| 最近记录: |