Adam Lewis
Adam Lewis

Reputation: 7257

Is there a better solution than virtualenv for server side python code?

I have been using virtualenv and virtual envwrapper for years while doing development. Until recently, I have been lucky and the systems / servers (*nix) I deployed too have had no other Python applications running so I have never had to worry about conflicting site-packages.

Google searching didn't turn anything up for me, so I was hoping the community could help guide me towards a common approach to managing python dependencies on a deployed system / server.

Clarifications

  1. It's an important note that the systems I am deploying to are single board computers with limited resources. This rules out implementations such as using a VM for each application.
  2. At the time of asking, I cannot fault virtualenv on any fronts (possibly because I haven't tried it on the server yet)
  3. The applications I am deploying are, for the most part, system processes (web servers, boot loaders, logging utils, etc...). Because these are run as background services (normally with root access) I do not know how virtualenv will fair.
  4. I was looking to see if there was a common way to manage python dependencies server side before I attempted to use something that, in my eyes, is geared towards the development side of things.

Upvotes: 1

Views: 121

Answers (1)

David Sanders
David Sanders

Reputation: 4129

Unless you have some other reason for not using virtualenv, it's production-ready and just as performant as your system python with system site packages. Virtualenv is basically just a copy of your python executable in its own directory tree. It works by invoking that separate executable instead of the system executable. As long as your process manager/init scripts point to the executable in your virtualenv, it should work fine.

Upvotes: 2

Related Questions