I'd like to package a Python virtualenv with fpm, so that I can deploy it to my servers. I want to setup the virtualenv somewhere in my home directory without having to use root permissions, but deploy to e.g. /opt. virtualenv itself seems to have no destdir option. I know that there is a relocatable option, but it failed for some packages in the past and I don't trust it to work in all cases. Are there any other options, besides setting up a chroot for packaging or actually setting up the virtualenv in my local /opt directory?


Inspired by this build script I've been testing and using virtualenv-tools for serveral month now to relocate virtual environments and never had any problems. It is easily possible to relocate a virtualenv with e.g. virtualenv-tools --update-path /opt/my_project/virtualenv and package it with fpm afterwards.


That is exactly what docker does.

fpm is good enough for packing the python instance and its third-party libraries. But if you want more customization like environment variables, it can't suit everything.

  • 1
    docker is absolutely great and you could surely ship a virtualenv with your dockerized application. In fact that would be best practice. But docker is not really a packaging system and it cannot be used in every case. So, this is not really answering my question. – brejoc Jan 2 '15 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.