Skip to content Skip to sidebar Skip to footer

Move The Virtualenvs To Another Host Folder

By error, I forgot to specify the WORKON_HOME variable before creating my virtual environments, and they were created in /root/.virtualenvs directory. They worked fine, and I did s

Solution 1:

Virtualenvs are not by default relocatable. You can use virtualenv --relocatable <virtualenv> to turn an existing virtualenv into a relocatable one, and see if that works. But that option is experimental and not really recommended for use.

The most reliable way is to create new virtualenvs. Use pip freeze -l > requirements.txt in the old ones to get a list of installed packages, create the new virtualenv, and use pip install -r requirements.txt to install the packages in the new one.

Solution 2:

I used the virtualenv --relocatable feature. It seemed to work but then I found a different python version installed:

$ . VirtualEnvs/moslog/bin/activate
(moslog)$ ~/VirtualEnvs/moslog/bin/mosloganalisys.py 
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

Remember to recreate the same virtualenv tree on the destination host.

Post a Comment for "Move The Virtualenvs To Another Host Folder"