gpt4 book ai didi

python - 无法使用requirements.txt文件在Openshift python 3.3盒上安装最新的python包

转载 作者:太空宇宙 更新时间:2023-11-03 16:58:03 25 4
gpt4 key购买 nike

当我将源代码推送到 openshift python Cartridge 时,我收到此消息。

Could not find a version that satisfies the requirement requests==2.9.1

pip 似乎找不到 requirements.txt 文件中指定的包版本,但它是最新版本,并且可以在 pypi 包索引目录中找到。如何强制 pip 使用 pypi 索引而不是它现在使用的索引?

如何重现此错误:

rhc app-create py33 python-3.3
cd py33
touch requirements.txt
echo requests==2.9.1 >> requirements.txt
git add .
git commit -a -m "requests2.9.1"
git push

openshift 服务器响应是:

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Stopping Python 3.3 cartridge
remote: Waiting for stop to finish
remote: Waiting for stop to finish
remote: Building git ref 'master', commit b6b983c
remote: Activating virtenv
remote: Checking for pip dependency listed in requirements.txt file..
remote: The directory '/var/lib/openshift/56b712f40c1e668ab20001a3/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
remote: The directory '/var/lib/openshift/56b712f40c1e668ab20001a3/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
remote: Collecting requests==2.9.1 (from -r /var/lib/openshift/56b712f40c1e668ab20001a3/app-root/runtime/repo/requirements.txt (line 1))
remote: Could not find a version that satisfies the requirement requests==2.9.1 (from -r /var/lib/openshift/56b712f40c1e668ab20001a3/app-root/runtime/repo/requirements.txt (line 1)) (from versions: 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.4.0, 0.4.1, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 0.8.6, 0.8.7, 0.8.8, 0.8.9, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.6, 0.10.7, 0.10.8, 0.11.1, 0.11.2, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.13.4, 0.13.5, 0.13.6, 0.13.7, 0.13.8, 0.13.9, 0.14.0, 0.14.1, 0.14.2, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 2.0.0, 2.0.1, 2.1.0, 2.2.0, 2.2.1, 2.3.0, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.6.2, 2.7.0, 2.8.0, 2.8.1)
remote: No matching distribution found for requests==2.9.1 (from -r /var/lib/openshift/56b712f40c1e668ab20001a3/app-root/runtime/repo/requirements.txt (line 1))
remote: Running setup.py script..
remote: running develop
remote: running egg_info
remote: creating YourAppName.egg-info
remote: writing YourAppName.egg-info/PKG-INFO
remote: writing dependency_links to YourAppName.egg-info/dependency_links.txt
remote: writing top-level names to YourAppName.egg-info/top_level.txt
remote: writing manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: reading manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: writing manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: running build_ext
remote: Creating /var/lib/openshift/56b712f40c1e668ab20001a3/app-root/runtime/dependencies/python/virtenv/venv/lib/python3.3/site-packages/YourAppName.egg-link (link to .)
remote: Adding YourAppName 1.0 to easy-install.pth file
remote:
remote: Installed /var/lib/openshift/56b712f40c1e668ab20001a3/app-root/runtime/repo
remote: Processing dependencies for YourAppName==1.0
remote: Finished processing dependencies for YourAppName==1.0
remote: Preparing build for deployment
remote: Deployment id is 19c7fb7b
remote: Activating deployment
remote: Starting Python 3.3 cartridge (Apache+mod_wsgi)
remote: Application directory "/" selected as DocumentRoot
remote: Application "wsgi.py" selected as default WSGI entry point
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://56b712f40c1e668ab20001a3@py33-chaticha.rhcloud.com/~/git/py33.git/
be50ea8..b6b983c master -> master

最佳答案

更新: submitting this problem to openshift bug reporting system之后他们解决了问题,现在一切都按预期进行。

正如“Vu Dinh”所说,问题的原因是:

We do maintain a mirror for PyPi for our OpenShift system. So, sometimes, when a new package comes out in PyPi, our mirror will need to be resynced and during that time, the issue that you mentioned may occur.

他们必须重新同步镜像才能解决此问题:

the mirror has been resynced and I have tested it on my end. The issue has been resolved and you should be able to install the newest version requests. Please give it a try and let us know the result.

<小时/>

原答案:

我找不到任何解决方案来解决我所描述的问题,因此现在我在 deploy 操作 Hook 中使用两行命令来临时修复我的问题:

echo "installing dependencies..."
pip install -r "$OPENSHIFT_REPO_DIR"requirements.txt

关于python - 无法使用requirements.txt文件在Openshift python 3.3盒上安装最新的python包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35252649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com