要提供有关我的问题的所有详细信息,最好提供一些背景知识。 在过去的几个月中,我一直在从事Django项目的工作。由于最近发生的明显事件使我在家中工作,因此不得不将项目转移到家用PC(使用Git)。
在工作中,我创建了一个requirements.txt,我将用它来在家获取所有软件包。这行得通,但无法在家中安装,我很快发现这是因为requirements.txt包含无效且不存在的软件包。
这是:
pkg-resources==0.0.0
我从需求文件中将其删除,然后一切正常。
快进到现在:我正在尝试将项目部署到我们的Amazon beantalk上,并且由于以下错误而失败:
2020-03-26 12:03:10 ERROR Your requirements.txt is invalid. Snapshot your logs for details.
2020-03-26 12:03:13 ERROR [Instance: i-0xxxxxxx] Command failed on instance. Return code: 1 Output: (TRUNCATED)...)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2020-03-26 12:03:13 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-03-26 12:03:13 ERROR Unsuccessful command execution on instance id(s) 'i-09xxxxxxxx'. Aborting the operation.
2020-03-26 12:03:13 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
所以我做了建议的事情,在活动日志中查看并看到:
Collecting pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 34))
Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 34)) (from versions: )
No matching distribution found for pkg-resources==0.0.0 (from -r /opt/python/ondeck/app/requirements.txt (line 34))
You are using pip version 9.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2020-03-26 11:40:21,832 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
其中包含:
No matching distribution found for pkg-resources==0.0.0
我不明白为什么它会寻找一段时间前从需求文件中删除的无效软件包。我尝试制作一个全新的需求文件并进行部署,尝试不使用需求文件进行部署,尝试对其进行更改,将其推送到Git,然后进行部署,但都没有成功。
它也显示第34行,而我的需求文件实际上是33行。