簡體   English   中英

無法使用Requirements.txt文件在Openshift python 3.3墨盒上安裝最新的python軟件包

[英]Can't install latest python package on Openshift python 3.3 cartridge using requirements.txt file

當我將源代碼推送到openshift python卡式盒時,我收到此消息。

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

更新: 將此問題提交給openshift錯誤報告系統后,他們解決了該問題,現在一切都按預期進行。

如“ Vu Dinh”所說的,該問題的原因是:

我們確實為OpenShift系統的PyPi維護了一個鏡像。 因此,有時,當PyPi中出現一個新軟件包時,我們的鏡像將需要重新同步,在此期間,您提到的問題可能會發生。

並且他們必須重新同步鏡像以解決此問題:

鏡像已重新同步,我已經對其進行了測試。 該問題已解決,您應該能夠安裝最新版本的請求。 請嘗試一下,讓我們知道結果。


原始答案:

我找不到我所描述問題的任何解決方案,所以現在我在deploy操作掛鈎中使用兩行命令作為解決我問題的臨時方法:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM