I'm configuring a jupyterlab single-user instance. The users will need to install Python packages using
pip install <package-name>
I want to configure pip so that pip install
is always called with argument --user
, even if it is invoked without --user
. Is it possible to achieve this? If so, how?
The reason behind it is that the $HOME directory is mounted on a persistent volume, and I want the user to still have its packages installed after restarting the jupyterlab server. By installing packages using pip install --user <package-name>
, the packages will be stored in $HOME/.local/lib/python${PY_MAJOR}.${PY_MINOR}/site-packages
and will therefore persist even after a server restart.
A solution that works on ubuntu:
Add this in $HOME/.pip/pip.conf
:
[install]
user = yes
Documentation: