pypa / pipx

Install and Run Python Applications in Isolated Environments
https://pipx.pypa.io
MIT License
10.01k stars 404 forks source link

Pipx package in Ubuntu 24.04 is obsolete, how to properly upgrade to 1.6.0 #1481

Open FredM67 opened 1 month ago

FredM67 commented 1 month ago

Pipx is in version 1.4.3 in Ubuntu 24-04.

How to upgrade to the 1.6.0 properly ? (without breaking anything ! )

huxuan commented 1 month ago

I personally recommend install pipx with pipx!

pipx install pipx
# And optional remove the obsolete apt pipx!
sudo apt purge --autoremove pipx

You may need to restart the shell or run command hash -r to make pipx command work.

Reference: https://github.com/pypa/pipx/discussions/1341 https://github.com/pypa/pipx/issues/1449

smanleyjr-alg commented 1 month ago

On ubuntu 24.04 this puts pipx in ~/.local/bin instead of /usr/local/bin

sudo apt install pipx               # installs pipx version 1.4.3 to /usr/local/bin  recall --global is busted
pipx ensurepath                     # adds ~/.local/bin to path
pipx install pipx                   # installs latest pipx to ~/.local/bin 
sudo apt purge --autoremove pipx    # remove pipx 1.4.3 via apt,  and all extra files including autocomplete from /usr/local/bin

restart shell then try pipx from sudo results in this failing:

sudo pipx ensurepath --global       # <-- fails, pipx command not found

To Fix I continued with:

sudo ~/.local/bin/pipx install pipx --global   #installs latest pipx version to /usr/local/bin because --global works.
pipx uninstall pipx                            # remove the local version

restart the shell

pipx ensurepath                                # make sure the ~/.local/bin is added to $PATH
sudo pipx ensurepath --global                  # make sure that /usr/local/bin is set to global install 

It all works far as I can tell. No issues with using pipx or upgrading it. Net effect is a way of installing/updating without editing a environment var, path, or rc file by hand...