Port Python virtualenv to another system
Question: I am using many python packages like numpy, bottleneck, h5py, ... for my daily
work on my computer. Since I am root on this machine it is no problem to
install these packages. However I would like to use my "environment" of
different packages also on a server machine where I only have a normal user
account. So I thought about creating a virtual environment (with virtualenv)
on my machine by installing all needed packages in there. Then I just copy the
whole folder to the server and can run everything from it?

My machine uses Fedora 19 whereas the server uses Ubuntu. Is this a problem? I
could not find any information on how to move such a virtual environment to
another system. The reason I would like to create the virtual environment on
my machine first is that there are a lot of tools missing on the server like
python-dev, so I can't compile numpy for instance.

I looked into Anaconda and Enthought Python distributions, but they don't
include a couple of packages I need. Also, there should be a completely "open"
way for this problem?

Moving the virtual environment to the server failed, since it is complaining
about some missing files when I import the packages. This is not surprising
probably...


Answer: You shouldn't move your virtualenv since it is essentially linked to your
system python and the binary won't work on other machines.

However... you can export a list of installed packages and install them in
another virtualenv through a `requirements.txt` file.

Basically, what I usually do with most of my projects:

    
    
    # Generate a requirements file:
    pip freeze > requirements.txt
    

On the new machine:

    
    
    # This uses virtualenvwrapper, but you can do it without as well
    mkproject my_project_name
    git clone git://..../ .
    pip install -r requirements.txt
    

