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

时间:2016-02-07 11:03:14

标签: python pip openshift

当我将源代码推送到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

1 个答案:

答案 0 :(得分:1)

更新:submitting this problem to openshift bug reporting system之后他们解决了问题,现在一切正常。

问题的原因,如" Vu Dinh"那里说,是:

  

我们为OpenShift系统维护PyPi镜像。因此,有时候,当PyPi中出现一个新包时,我们的镜像需要重新启动,在此期间,您提到的问题可能会发生。

他们不得不重新同步镜像来解决这个问题:

  

镜子已经重新安装,我已经测试了它。问题已解决,您应该能够安装最新版本的请求。请试一试,让我们知道结果。

原始答案:

我找不到我所描述的问题的任何解决方案,所以现在我在deploy动作挂钩中使用两行命令作为我的问题的临时修复:

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