Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export pip packages

Tags:

python

pip

I have a project with multiple dependencies installed using virtualenv and pip. I want to run my project on a server which does not have pip installed. Unfortunately, installing pip is not an option.

Is there a way to export my required packages and bundle them with my project? What is the common approach in this situation?

like image 930
fwind Avatar asked Aug 11 '15 13:08

fwind


1 Answers

Twitter uses pex files to bundle Python code with its dependencies. This will produce a single file. Another relevant tool is platter which also aims to reduce the complexity of deploying Python code to a server.

Another alternative is to write a tool yourself which creates a zip file with the Python and dependencies and unzips it in the right location on the server.

In Python 3.5 the module zipapp was introduced to improve support for this way of deploying / using code. This allows you to manage the creation of zip files containing Python code and run them directly using the Python interpreter.

like image 85
Simeon Visser Avatar answered Oct 04 '22 19:10

Simeon Visser