virtualenv relocatable -- does it really work

un33k picture un33k · Aug 22, 2011 · Viewed 18.9k times · Source

I kept looking for answer but didn't find one. I have a virtual env dir, a project dir with a req.txt. When I run pip -r req.txt, it installs some apps from github (source) and some from pypi. The ones from pypi are fine after relocatable call on the virtual evn, however the links in the site-packages for the apps that it installed from github still point to the old directory location.

Anyone else has seen this behavior? Any quick way around it? Also, relocatable is not honoring the --no-site-packages flag that was used on the virtualenv originally. Once you move the virtual and reactivate it, everything is visible from the system's site-packages. Docs indicates this behavior as a fact, so I am wondering if there is any quick way around this?

Answer

zeekay picture zeekay · Aug 22, 2011

As stated in the documentation --relocatable is an experimental option, so it's not surprising you are having difficulties with it. That said, did you remember to re-run --relocatable after installing new packages? If you installed the packages from github with -e, that might be an issue, as it doesn't install into site-packages, but symlinks into it. As an alternative to using --relocatable, you can usually erase the virtualenv-specific files and recreate it in place (which I've done a couple times when switching between platforms).