2013-02-23 30 views
7

我跑heroku push master刪除Python包,並得到了這一點:手動在Heroku

----- Python app detected 
----- No runtime.txt provided; assuming python-2.7.3. 
----- Using Python runtime (python-2.7.3) 
----- Installing dependencies using Pip (1.2.1) 
     Downloading/unpacking Django-1.5c2 from https://www.djangoproject.com/download/1.5c2/tarball (from -r 
                              requirements.txt (line 1)) 
      Cannot determine compression type for file /tmp/pip-rYIGHS-unpack/tarball.ksh 
      Running setup.py egg_info for package Django-1.5c2 

     Installing collected packages: Django-1.5c2 
      Running setup.py install for Django-1.5c2 
      changing mode of build/scripts-2.7/django-admin.py from 600 to 755 

      changing mode of /app/.heroku/python/bin/django-admin.py to 755 


      ======== 
      WARNING! 
      ======== 

      You have just installed Django over top of an existing 
      installation, without removing it first. Because of this, 
      your install may now include extraneous files from a 
      previous version that have since been removed from 
      Django. This is known to cause a variety of problems. You 
      should manually remove the 

      /app/.heroku/python/lib/python2.7/site-packages/django 

      directory and re-install Django. 

     Successfully installed Django-1.5c2 

我怎樣才能刪除以前的Django的包?

UPDATE: 我requirements.txt:

https://www.djangoproject.com/download/1.5c2/tarball/**#egg=django** 
South==0.7.6 
argparse==1.2.1 
distribute==0.6.24 
dj-database-url==0.2.1 
psycopg2==2.4.6 
wsgiref==0.1.2 
PIL==1.1.7 

粗體固定上述警告的文本​​。

更新2: 由於Django的1.5正式發佈,我只是用PIP凍結:

Django==1.5 
South==0.7.6 
argparse==1.2.1 
distribute==0.6.24 
dj-database-url==0.2.1 
psycopg2==2.4.6 
wsgiref==0.1.2 
PIL==1.1.7 
+0

Django是如何在你的'requirements.txt'中指定的?你是否在告訴它使用特定版本? – culix 2013-02-25 03:27:45

+0

請參閱上面的更新。 – blaze 2013-02-28 22:45:37

+0

@metroxylon當您推送更改'heroku logs -t'時,檢查您的dyno會發生什麼。嘗試從需求中刪除'Django == 1.5',提交,推送到heroku,然後添加和提交Django。 – nk9 2013-03-01 07:27:49

回答

14

其中Heroku的緩存破包,有沒有辦法讓出來我有問題。 Python buildpack應該有一些支持刷新這個緩存(CACHE_DIR),但是它沒有。

有一種解決方法:按照these instructions的說法將Python運行時更改爲3.3.0(如果您的應用程序確實支持Python 3,則無關緊要)。然後將其更改回默認值。改變你的Python運行時然後部署的行爲將強制buildpack徹底清除緩存。據我所知,這是擦除緩存的唯一實用方法。

+1

這解決了我的問題。我嘗試手動運行'heroku運行pip卸載my_package'這「工作」(沒有失敗),但包仍然在系統中,並導致我的問題。謝謝你的提示! – Micah 2013-11-27 13:08:16

+0

它不起作用了。 – 2013-12-18 18:03:01

+0

是的,至今仍然有效。更改(或首次添加)runtime.txt,然後重新部署會導致Heroku創建新的運行時環境,從而有效地銷燬任何遺留問題,例如拒絕使用同一軟件包的不同版本覆蓋以前安裝的軟件包從github網址。 – 2014-02-09 05:16:34

0

按當前virtenv包文件

pip freeze > requirements.txt 

提交

git commit -am 'update packages' 

而且push to heroku

git push heroku 

而且herocu重建環境

Counting objects: 13, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (11/11), done. 
Writing objects: 100% (13/13), 1.26 KiB, done. 
Total 13 (delta 3), reused 0 (delta 0) 
-----> Python app detected 
-----> No runtime.txt provided; assuming python-2.7.3. 
-----> Preparing Python runtime (python-2.7.3) 
-----> Installing Distribute (0.6.34) 
-----> Installing Pip (1.2.1) 
-----> Installing dependencies using Pip (1.2.1) 
Downloading/unpacking Flask==0.9 (from -r requirements.txt (line 1)) 
Running setup.py egg_info for package Flask 
+0

這是我做的(除了外部的雞蛋)。將更新與我的requirements.txt – blaze 2013-02-28 22:40:23