过时错误: 未安装'wheel'包。

8
在尝试部署Python代码时,我们遇到了以下弃用错误。我们正在使用Python 3.7.12。我们尝试安装wheel包作为部署的一部分,但没有成功。我们需要指定任何特定版本的wheel吗?您能否提供一些帮助?
2022-11-14T19:34:39.7229174Z ##[error]Bash wrote one or more lines to the standard error stream.
2022-11-14T19:34:39.7241399Z ##[error]  DEPRECATION: wrapt is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

2022-11-14T19:34:39.7244863Z ##[error]  DEPRECATION: keyless-fernet is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

2022-11-14T19:34:39.7247898Z ##[error]  DEPRECATION: tornado is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

2022-11-14T19:34:39.7251293Z ##[error]  DEPRECATION: pyrsistent is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

2022-11-14T19:34:39.7254435Z ##[error]  DEPRECATION: Flask-JWT-Extended is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559

enter image description here


1
这些应该是警告,而不是实际错误。请检查包是否已经安装。如果失败,请确保创建一个 [mre]。请按照步骤进行操作,从创建新的虚拟环境开始,以重现问题。请注意 pip 和 Python 的版本。 - Karl Knechtel
谢谢。我们通过实施答案部分分享的以下解决方案解决了这个问题。 - Partha
3个回答

8
我们已经在安装命令中添加了一个标志“--use-pep517”,以解决版本问题。因此,下面提供了运行 requirement.txt 文件的最终脚本,其中包含我们所有的包。
pip install -r requirements.txt --use-pep517

不是解决方案,只是在新版本的pip中隐藏问题的一种方式。 - stats con chris
不是解决方案,只是在新版本的pip中隐藏问题的一种方式。 - undefined

2

安装wheel包应该解决警告中建议的问题。

您只需确保在安装有问题的包之前,单独使用pip install调用安装它,而不是将wheel添加到requirements.txt中,这样它可以用于为您要安装的包构建轮子。

假设您正在使用Docker部署代码,这里是一个示例的Dockerfile:

FROM locustio/locust:2.15.1 # sample base image

COPY requirements.txt .

RUN pip install wheel
RUN pip install -r requirements.txt

# RUN pip install wheel -r requirements.txt <- this won't fix a problem

如果您不想要额外的图像层,您也可以通过单个RUN命令实现相同的效果。
RUN pip install wheel && pip install -r requirements.txt

-1

已废弃:正在使用遗留的setup.py install方法安装spacy,因为它没有pyproject.toml并且未安装wheel包。 pip 23.1将执行此行为更改,可能的替代方案是启用--use-pep517选项。

讨论可在https://github.com/pypa/pip/issues/8559中找到。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接