SUMMARY: By default, the pip cache directory is in $HOME
, which causes the “pip install …”
command to quickly fill up your home space with big files when you are installing python packages. The pip cache directory location needs to be changed.
/share
space using the command below. Note, you can provide any path you like, but just make sure it is somewhere in your “/share/$GROUP/$USER/”
space. If you decide on a different path, use it here, and in the rest of the steps below.
mkdir -p /share/$GROUP/$USER/pip/cache
$HOME/.config/pip/pip.conf
, and set the global pip cache-dir in that file to the path of your pip cache directory.
pip config set global.cache-dir "/share/$GROUP/$USER/pip/cache"
$GROUP
and $USER
):cache-dir = /share/$GROUP/$USER/pip/cache
cat $HOME/.config/pip/pip.confIssuing the command below should show an empty directory, and should not show any errors in trying to list the directory.
ls "/share/$GROUP/$USER/pip/cache"Issuing command below should return the the same result as the following command:
realpath "/share/$GROUP/$USER/pip/cache"
.
pip cache dir
Now all your pip cache files will go to /share/$GROUP/$USER/pip/cache
. Your home directory should no longer be filled up by additional “pip install…”
cache files.