It's been a little while since I looked, but I think other
distributions of python (debian, rh, etc) will use the same
site-packages for patch-level upgrades (e.g. 2.7.5-2.7.6), which would
keep virtualenvs working. Brew's method of making a new site-packages
results in the locations changing, with this result. If I'm not
mistaken it might be a decent suggestion to the homebrew python
maintainers to make patch upgrades smoother.

On Wed, Apr 30, 2014 at 6:47 PM, John Heasly <[email protected]> wrote:
> 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 <[email protected]> 
> 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 <[email protected]>
>> To: [email protected]
>> 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
>>> [email protected]
>>> https://mail.python.org/mailman/listinfo/portland
>>>
>> _______________________________________________
>> Portland mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/portland
>
> _______________________________________________
> Portland mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/portland
_______________________________________________
Portland mailing list
[email protected]
https://mail.python.org/mailman/listinfo/portland

Reply via email to