2012-08-06 31 views
3

有誰知道軟件包安裝順序是否在Python中很重要?更具體地講我的Django的網站我建立PIP requirements.txt是:在Python中更改軟件包安裝順序

Django==1.4 
MySQL-python==1.2.3 
django-evolution==0.6.7 
django-pagination==1.0.7 
boto==2.5.2 
numpy==1.6.2 
requests==0.13.1 
simplejson==2.5.2 
gunicorn==0.14.6 

當部署到Heroku的應用程序將與以下錯誤崩潰:

2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [12] [INFO] Worker exiting (pid: 12) 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [8] [INFO] Worker exiting (pid: 8) 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Handling signal: term 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [7] [INFO] Worker exiting (pid: 7) 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Starting gunicorn 0.14.6 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Listening at: http://0.0.0.0:20132 (4) 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Using worker: sync 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [7] [INFO] Booting worker with pid: 7 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [8] [INFO] Booting worker with pid: 8 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [9] [INFO] Booting worker with pid: 9 
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [10] [INFO] Booting worker with pid: 10 
2012-08-05T09:26:57+00:00 heroku[web.1]: State changed from starting to up 
2012-08-05T09:26:57+00:00 heroku[web.1]: Process exited with status 143 
2012-08-05T09:27:17+00:00 app[web.1]: Usage: gunicorn [options] 
2012-08-05T09:27:17+00:00 app[web.1]: gunicorn: error: no such option: --workers 
2012-08-05T09:27:17+00:00 app[web.1]: 
2012-08-05T09:27:17+00:00 app[web.1]: 2012-08-05 09:27:17 [9] [INFO] Worker exiting (pid: 9) 

凡我Procfile如下:

web: python manage.py collectstatic --noinput; gunicorn commerical_production.wsgi:application --workers=4 --bind=0.0.0.0:$PORT 

該問題已通過將要求順序簡單地更改爲:

Django==1.4 
gunicorn==0.14.6 
MySQL-python==1.2.3 
django-evolution==0.6.7 
django-pagination==1.0.7 
boto==2.5.2 
numpy==1.6.2 
requests==0.13.1 
simplejson==2.5.2 

(注意:gunicorn現在移到頂部)

我發現了這一點,通過幸運的是猜測,試圖改變進口秩序,但我的問題是,有沒有其他人遇到這個問題,或者知道爲什麼從requirements.txt安裝軟件包的順序會有所不同?這個問題可以指示我的應用程序中的一些更大的依賴性問題嗎?

+1

這通常應該沒有關係,因爲在應用程序允許運行之前必須安裝所有東西。不知道heroku是否在做一些不同的事情。 – 2012-08-06 06:57:11

回答

1

Pip不太擅長處理軟件包相關性easy_install。我們在我們的項目中遇到了同樣的問題。即使req.txt中的順序是正確的,我們仍然存在與訂單相關的依賴性問題。

我的解決方法是喂req.txt到的easy_install,但比你應該小心的包是編輯還是那些從GitHub等

您可能要檢查以下鏈接:

http://metak4ml.blogspot.com/2009/08/easyinstall-read-pip-requirementstxt.html http://community.webfaction.com/questions/1220/using-easy_install-to-get-all-dependencies-listed-in-requirementstxt(同時讀取行的答案是接近我們做什麼)

0

Pyton安裝程序安裝腳本包含已經需求和訂購,所以安裝過程將尊重和安裝i n爲需求文件中的每個應用程序訂購所有需求。

所以,如果您有需要別人自己的應用程序,把你的要求,只有在你的設置文件和在requirements.txt

對於不需要編譯第三方Python應用程序註冊的主應用程序你不必擔心您的要求中的順序。

否則eazy_install將被棄用,請使用pip來代替它。