如何使用virtualenv卸载heroku雪松堆栈? [英] how to pip uninstall with virtualenv on heroku cedar stack?

查看:130
本文介绍了如何使用virtualenv卸载heroku雪松堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



heroku run bin / python bin / pip卸载任何



Pip显示/ app树中的模块,然后宣称已经安装了该模块,但再次运行相同的命令将显示它安装在/ app树中的相同位置。



有没有办法让pip uinstall成功?






Heroku运行实例化一个新的dyno并运行仅在该dyno中指定的命令。 Dynos是短暂的,这就是为什么pip卸载的结果不会出现问题。

更新2013-09- 30:目前清除virtualenv的方式似乎是在 runtime.txt中指定不同的python运行时版本 正如Github所述 Heroku的devcenter参考资料

请注意,Heroku目前只支持并支持Python的使用2.7.4和3.3.2,所以除非您的应用程序同时支持Python 2.7.4和3.3.2,否则您可能需要使用您希望切换到的运行时进行测试(当前可在 http ://envy-versions.s3.amazonaws.com/$PYTHON_VERSION.tar.bz2 ,但在大多数情况下,切换2.7.4和2.7.3之间不应该是个问题)



感谢@Jesse为您提供的最新答案,以及这些评论者让我意识到这个问题。






在2012年11月〜 / strong>(我还没有更新过链接的buildpack,我的pull请求已关闭,并且CLEAN_VIRTUALENV功能在官方buildpack的某个位置被删除):

大卫解释说,你不能点击卸载一个包,但你可以清除并重新安装整个virtualenv。使用 user-env-compile 实验室功能和 CLEAN_VIRTUALENV选项清除virtualenv:

  heroku labs:启用user-env-compile 
heroku config:add CLEAN_VIRTUALENV = true

目前这是行不通的,因为有一个错误。您需要使用buildpack的我的分支,直到获取固定上游(拉取请求已关闭):

  heroku config:add BUILDPACK_URL = https://github.com/blaze33/heroku-buildpack-python.git 

现在推新代码,你会注意到整个virtualenv得到重新安装。



Andrey's答案自2012年3月23日起不再有效。新风格virtualenv 提交将虚拟env从/ app移动到/app/.heroku/venv,但清除分支没有更新,以便最终获得不在PYTHONHOME中的virtualenv。



避免在每个pu之后重新安装所有内容sh,禁用该选项:

  heroku labs:禁用user-env-compile 
heroku配置:删除CLEAN_VIRTUALENV BUILDPACK_URL


I tried to uninstall a module on heroku with:

heroku run bin/python bin/pip uninstall whatever

Pip shows the module in the /app tree then claims to have uinstalled the module, but running the same command again shows it installed in the same location in the /app tree.

Is there a way to get pip uinstall to succeed?


Heroku run instantiates a new dyno and runs the command specified in that dyno only. Dynos are ephemeral which is why the results of the pip uninstall don't stick.

解决方案

Updated 2013-09-30: the current way to clear the virtualenv seems to specify a different python runtime version in runtime.txt as stated on Github and in the Heroku's devcenter reference.

Be aware that Heroku currently "only endorses and supports the use of Python 2.7.4 and 3.3.2" so unless your application supports both Python 2.7.4 and 3.3.2, you may want to test it with the runtime you'll want to switch to (currently available at http://envy-versions.s3.amazonaws.com/$PYTHON_VERSION.tar.bz2, though it shouldn't be an issue to switch e.g. between 2.7.4 and 2.7.3 in most cases).

Thanks @Jesse for your up-to-date answer and to the commenters who made me aware of the issue.


Was up-to-date in ~november 2012 (I haven't since updated the linked buildpack, my pull request was closed and the CLEAN_VIRTUALENV feature was dropped at some point by the official buildpack):

As David explained, you cannot pip uninstall one package but you can purge and reinstall the whole virtualenv. Use the user-env-compile lab feature with the CLEAN_VIRTUALENV option to purge the virtualenv:

heroku labs:enable user-env-compile
heroku config:add CLEAN_VIRTUALENV=true

Currently this won't work because there is a bug. You'll need to use my fork of the buildpack until this get fixed upstream (pull request was closed) :

heroku config:add BUILDPACK_URL=https://github.com/blaze33/heroku-buildpack-python.git

Now push your new code and you'll notice that the whole virtualenv gets reinstalled.

Andrey's answer no longer works since March 23 2012. The new style virtualenv commit moved the virtual env from /app to /app/.heroku/venv but the purge branch wasn't updated to catch up so that you end up with a virtualenv not being in PYTHONHOME.

To avoid reinstalling everything after each push, disable the option:

heroku labs:disable user-env-compile
heroku config:remove CLEAN_VIRTUALENV BUILDPACK_URL

这篇关于如何使用virtualenv卸载heroku雪松堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆