【发布时间】:2019-03-26 08:40:07
【问题描述】:
我使用 Heroku 作为开发服务器。当我尝试将我的 Django 应用程序推送到 Heroku 时,它首先尝试从 requirements.txt 文件安装我的包。
requests==2.18.3
ssh-import-id==5.5
问题是我的一个包依赖于其他包。在上述包中,ssh-import-id 需要已经安装了requests 包。所以当我推送应用时,pip 无法安装并停止部署。
Collecting requests==2.18.3 (from -r re.txt (line 1))
Using cached https://files.pythonhosted.org/packages/ba/92/c35ed010e8f96781f08dfa6d9a6a19445a175a9304aceedece77cd48b68f/requests-2.18.3-py2.py3-none-any.whl
Collecting ssh-import-id==5.5 (from -r re.txt (line 2))
Using cached https://files.pythonhosted.org/packages/66/cc/0a8662a2d2a781db546944f3820b9a3a1a664a47c000577b7fb4db2dfbf8/ssh-import-id-5.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-go0a5mxf/ssh-import-id/setup.py", line 20, in <module>
from ssh_import_id import __version__
File "/tmp/pip-install-go0a5mxf/ssh-import-id/ssh_import_id/__init__.py", line 25, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-go0a5mxf/ssh-import-id/
我需要一次尝试使用 pip 安装所有列出的软件包。因为默认情况下 Heroku 会运行 pip install -r requirements.txt。
【问题讨论】:
-
这可能是一个错误。请报告。同时您可以尝试从需求文件中删除请求吗?
-
这是一个已经在跟踪问题的错误:bugs.launchpad.net/ssh-import-id/+bug/1696021。他们在那里提到了一个修复,但我认为这是在 5.5 之后添加的。
-
这个问题似乎只影响旧版本的 Python。您应该将 runtime.txt 设置为 python-3.7.2。
-
@SuperShoot 将包从 5.5 更新到最新版本也不起作用。同样的问题
-
它有完全相同的回溯吗?例如。包括:
File "/tmp/pip-install-go0a5mxf/ssh-import-id/setup.py", line 20, in <module> from ssh_import_id import __version__