Search code examples
pythondeploymentstatic-librariesvirtualenvstatic-linking

Which kind of python setup is more portable?


I am wondering and pondering what python setup to use. Portable in sense of Portable Python in Windows (but i need such for Linux).

I am working on python project with a lot of dependencies , including C/C++ libraries , reuses some perl scripts , and even Java Tika lib to parse multiple document types. I want to put them all in local folder and bundle it so that they do not have to re-install when i am going to set it up on different servers (which have different Linux Distro , Gentoo , Ubuntu and Redhat ).

I wont use python provided by distro because it causes many headaches.

From studying around , these are choices I got :

1 - VirtualENV (But it defeat my purpose as it is not designed to relocate).

2 - Statically Compiling Python (Not sure how it will work, I do not see many success stories on it)

3 - Local (Manually) Compiling Python (Wont work at different Libc version right?)

Any other choices ? Please let me know..

Thanks in advance.


Solution

  • virtualenv is problematic, because it needs the libraries from the computer. Because nowadays most linux distros have python installed by default, the only case that'll be a problem is when the installed version on the computer is different than the one you're using.

    However, I believe you can fix that by copying all the libs on PYTHONPATH that are placed on your local installation to the virtualenv folder.

    I don't know about 2 or 3, but you could also try to manually compile python to your USB disk and pip your libraries.