How do I update a virtualenv?

Skip Montanaro skip at pobox.com
Mon Oct 28 21:07:39 EDT 2013


>> Hmmm... And my git repo?
>
> Usually the virtualenv is outside the git repo (and vice-versa), but git
> repos are also easy to recreate from the git server if you need to.  Maybe I
> don't understand what you mean?

I'm using Heroku, following their instructions. They have a "git init"
in the midst of things, so I wind up with a git repo that matches up
one-to-one for my Django project. ("git push" installs).

Part of the problem here is, of course, that I have done essentially
no web work since the days of editing HTML directly. I just have to
hunt around for something I can sort of understand and that has some
recommendations from someone I trust (in this case, some of the
denizens of chicago at python.org), and head off in that direction. I'm
sure the combinations of packaging systems, web application platforms,
and distribution tools are nearly limitless. I don't enough time left
to investigate and try out every combination, so for now, it's
HomeBrew+Django+Heroku. The decision to switch from MacPorts to
HomeBrew may well turn out to be problematic, but it is what it is.

>> I imagine I will eventually figure this out,
>> but updating an existing virtualenv in place to adapt to a new version
>> of Python (say, a new micro) or some of its libraries (contents of
>> requirements.txt) seems like it would be a very nice thing to have.
>
> "pip install --upgrade" will upgrade your Python packages.  "pip install -r
> requirements.txt"  will install new packages or versions named in the
> requirements.txt file.

Thanks. That's done.

So, in addition to the various virtualenv bits I needed to

* move .git and .gitignore from the old directory
* recreate the heroku stuff
* set up the remote heroku association again
* push everything
* sync the database

None of these things have anything to do with virtualenv, but they all
were things *in* the virtualenv. There are clearly various dot files
left laying around in my old virtualenv. I still think it would have
been easier overall if I was able to refresh the virtualenv in place.
It all boils down to a virtualenv only being one piece of a larger
puzzle. I'm not sure its constraints should drive the entire process.

Skip



More information about the Python-list mailing list