[portland] A homebrew-ed Python + virtualenv + virtualenvwrapper question

John Heasly jheasly at earthlink.net
Thu May 1 03:47:16 CEST 2014


Hello Miguel —

Yes, I've definitely requirements.txt’d all my current virtualenvs.

Not having up-to-date requirements.txt for the virtualenvs I had to re-create, I was able to figure out what apps were installed by inspecting the [virtualenvs root directory]/[virtualenv]/lib/python2.7/site-packages directory of each of the virtualenvs. Actually, I was able to cherry-pick/copy the .py files from the old /site-packages/ into the new. It was just a Python 2.7.5 to 2.7.6 transition and so this seems to be have worked. Any bigger of a Python version jump, and who knows … 

Thanks for your reply,
John 

On Apr 30, 2014, at 4:19 PM, Miguel Grinberg <miguelgrinberg50 at gmail.com> wrote:

> Hi John,
> 
> I consider virtualenvs disposable, and by that I mean that I always ensure that I can regenerate them easily. For each virtualenv I keep a requirements file that lists all the packages I have installed including indirect dependencies, and with the exact version numbers. I update this file whenever I make changes to a virtualenv. Then when a virtualenv stops working for any reason I just regenerate it.
> 
> To export a requirements file you can use this command (note this must be done on a working virtualenv):
> 
> $ pip freeze > requirements.txt
> 
> To populate a virtualenv from a requirements file use this command after activating it:
> 
> $ pip install -r requirements.txt
> 
> I hope this helps.
> 
> Miguel
> 
> ----- Original Message -----
> From: John Heasly <jheasly at earthlink.net>
> To: portland at python.org
> Date: Wed, 30 Apr 2014 13:25:05 -0700
> Subject: [portland] A homebrew-ed Python + virtualenv + virtualenvwrapper question
> 
>> Hello all,
>> 
>> I’ve been bit by creating virtualenvs against a homebrew-installed systemwide Python, upgrading the system Python, running "brew cleanup” which deletes the previous Python that the virtualenv was created against. Is there a way to get virtualenvs to “see” the new Python? Or should I just stop with the “brew cleanup” after brew upgrading the system Python?
>> 
>> I figure this is a common enough scenario that there has to be a good answer/best practice/light to dim the darkness of my ignorance.
>> 
>> Thanks,
>> John
>> _______________________________________________
>> Portland mailing list
>> Portland at python.org
>> https://mail.python.org/mailman/listinfo/portland
>> 
> _______________________________________________
> Portland mailing list
> Portland at python.org
> https://mail.python.org/mailman/listinfo/portland



More information about the Portland mailing list