Open Lordfirespeed opened 1 month ago
Here's what I did to install pipx
system-wide on a generic linux machine.
I chose to create a user for it because I wanted to use pipenv
to simplify the update process, but one could just as easily skip that whole bit and install pipx
into the venv with pip
with /opt/pipx-cli
owned by root
.
sudo adduser pipx-cli --group --system --disabled-password --home /opt/pipx-cli --shell /bin/bash
- create
a new user pipx-cli
to manage pipx-cli
export GLOBIGNORE=".:.."
to ignore the special names .
, ..
from Bash glob resultssudo cp /etc/skel/.* /opt/pipx-cli
- /etc/skel
is not used for system users, we have to do this ourselvessudo chown -R pipx-cli:pipx-cli /opt/pipx-cli/
- files copied from /etc/skel
are still owned by root
sudo chmod o+rx /opt/pipx-cli
to enable read and execute perms to 'others' on pipx-cli
's homedirsudo -u pipx-cli -i
- start a login shell as user pipx-cli
python3 -m pip install --user pipenv
- install pipenv for pipx-cli
source ~/.profile
to add newly created directory containing the pipenv
executable to $PATH
mkdir .venv && pipenv install pipx
- create a new virtualenv, .venv
, using pipenv
which contains pipx
nano pipx-cli
- create a new script named pipx-cli
. Provide the contents:
#!/bin/bash
# https://stackoverflow.com/a/77663806/11045433
DIRNAME=$(dirname $( readlink -f "${BASH_SOURCE[0]:-"$(command -v -- "$0")"}" ))
source $DIRNAME/.venv/bin/activate
pipx $@
Press ctrl
+x
, then y
, then Enter
to save the file.
chmod a+x pipx-cli
- for all users (a
), add (+
) the permission to execute (x
) pipx-cli
ctrl
+d
to end the session as pipx-cli
sudo ln -s /opt/pipx-cli/pipx-cli /usr/local/bin/pipx
- make a command, pipx
, available system-wide that invokes
the pipx-cli
script
This is a documentation issue (in my opinion) - having tried a few ways, I couldn't find a convenient command to call a
--user
installation ofpipx
asroot
.Therefore, the remedial steps I would take here are
pip --user
" installation example in the README making clarifying that--user
installations won't work for installing applications system-widepip -H
(not recommended)" installation example to the READMEpipx
'-like environment forpipx