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?
Asked
Active
Viewed 4,283 times
2 Answers
2
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.

Brett Holman
- 165
- 8

brejoc
- 31
- 1
- 6
-
1virtualenv-tools seems not to be maintained anymore. If you are using python3 probably you'll need to use virtualenv-tools3 – Ictus Aug 23 '20 at 03:02
0
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.

Andrew Schulman
- 8,811
- 21
- 32
- 47

Dreampuf
- 101
- 2
-
1docker 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 02 '15 at 11:17