- bog standard, pep-0370 python:
$ PYTHONUSERBASE=$PWD/pep-370-env pip install --user flask
…
$ du -sh pep-370-env/
3.1M pep-370-env/
- virtualenv (and we need this installed before-hand):
$ virtualenv virt-env
$ ./virt-env/bin/pip install flask
…
$ du -sh virt-env/
17M virt-env/
On top of the needless dependencies in the virtualenv case, pep-370-env/
is relocatable, and virt-env/
is not
(ie. it depends on the paths of where it was installed originally).
ps. this is how you enable the pep-0370 environment dependencies in a systemd service:
…
[Service]
Environment=PYTHONUSERBASE=/opt/my-app/pep-370-env
ExecStart=/usr/bin/python /opt/my-app/main.py
…
One line, bam 💥 it works. I have no idea how you do that with the virtualenv environment.