Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FredM67 opened this issue Jul 16, 2024 · 6 comments
Open
Labels
question Further information is requested

Comments

@FredM67
Copy link

FredM67 commented Jul 16, 2024

Pipx is in version 1.4.3 in Ubuntu 24-04.

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

@huxuan
Copy link
Member

huxuan commented Jul 16, 2024

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: #1341 #1449

@huxuan huxuan added the question Further information is requested label Jul 17, 2024
@smanleyjr-alg
Copy link

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...

@zinc75
Copy link

zinc75 commented Jan 10, 2025

Hi everyone,

I’ve created a backported version of pipx 1.6.0 for Ubuntu 24.04 LTS (Noble), addressing this issue and thos like [#1524](#1524) where sudo pipx ensurepath --global fails.

You can find the backport (from official Ubuntu 24.10 sources) along with the compiled .deb package and build instructions in my repository:

https://github.com/zinc75/pipx-1.6.0-backport-ubuntu-2404-lts

What’s included:

  • Precompiled .deb package for Ubuntu 24.04.
  • Source files, build scripts, and method to compile using sources from Ubuntu 24.10.

Installation is straightforward with the .deb package I built.

If you fear I might have modified anything from sources (I've not), I've also put the recipe to compile it yourself in the README from the official Ubuntu sources.

✨ 🌟 ✨ Enjoy ! ✨ 🌟 ✨

Here’s some additional information about my environment and installation:

$ uname -a
Linux proteus 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec  5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Package details :

$ apt-cache show pipx
Package: pipx
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 3442
Maintainer: Debian Python Team <[email protected]>
Architecture: all
Source: python-pipx
Version: 1.6.0-1
Depends: python3-venv, python3-argcomplete, python3-packaging, python3-platformdirs (>= 2.1), python3-tomli | python3-supported-min (>= 3.11), python3-userpath, python3:any
Description: execute binaries from Python packages in isolated environments
 pipx allows you to...
 .
  * Run the latest version of a CLI application from a package
    in a temporary virtual environment,
    leaving your system untouched after it finishes.
  * Install packages to isolated virtual environments,
    while globally exposing their CLI applications
    so you can run them from anywhere.
  * Easily list, upgrade, and uninstall packages
    that were installed with pipx.
 .
 pipx runs with regular user permissions,
 never calling "sudo pip install".
Description-md5:
Homepage: https://github.com/pypa/pipx

Verification :

$ pipx --version
1.6.0

Test on --global option :

$ sudo pipx ensurepath --global
[sudo] password for zinc:
/usr/local/bin is already in PATH.

⚠️  All pipx binary directories have been added to PATH. If you are sure you want to proceed, try again with the '--force' flag.

Otherwise pipx is ready to go! ✨ 🌟 ✨

Global install for cowsay :

$ sudo pipx install --global cowsay
  installed package cowsay 6.1, installed using Python 3.12.3
  These apps are now globally available
    - cowsay
done! ✨ 🌟 ✨

Everything seems fine.

Hope this helps !

@sofigio
Copy link

sofigio commented Jan 15, 2025

In my case I just want to install glances, I'm not a python developer, and I'm looking for a solution as simple as possible, to replicate it on all my new machines. (For ubuntu <24 I just did apt install python3-pip; pip3 install glances)

I don't like pipx ensurepath because adding /root/.local/bin to the path seems wrong...

This is the best solution I found so far (all done as root):

apt install pipx # Install 1.4
pipx install pipx # Install 1.7 in ~/.local/bin/
apt purge --autoremove pipx # Remove 1.4
~/.local/bin/pipx install --global pipx # Install 1.7 in /usr/local/bin/pipx
# logout and login again, then:
pipx uninstall pipx # Remove 1.7 from ~/.local/

ll ~/.local/bin/ # Make sure it's empty
whereis pipx # will give pipx: /usr/local/bin/pipx

Now pipx will be available for all users.
For example you can
sudo pipx install --global glances

@zinc75
Copy link

zinc75 commented Jan 15, 2025

Hi @sofigio,

I completely agree that getting the .deb package is the easiest way, which is exactly why I created a release in my GitHub repository with the .deb file! (pipx_1.6.0-1_all.deb)

Installing it is straightforward: just download the file and run the following command:

sudo dpkg -i pipx_1.6.0-1_all.deb  

The main purpose of hosting it in a repository is twofold:

  1. To allow users to verify that I haven't made any modifications to the source (for obvious security reasons).
  2. To document the process of backporting a .deb package for reproducibility.

This aligns perfectly with the principles of open source, doesn't it?

Regarding your suggested solution, where pipx is installed using pipx (twice), the official documentation (https://github.com/pypa/pipx#install-pipx) explicitly states:

Warning

It is not recommended to install pipx via pipx. If you'd like to do this anyway, take a look at the
pipx-in-pipx project and read about the limitations there.

For this reason, I chose to backport the Ubuntu 24.10 version of pipx. Providing choice is key, and the repository exists to serve both advanced users and end-users. Of course, there's no obligation to use it—it's entirely up to you!

Best regards,

@zinc75
Copy link

zinc75 commented Jan 15, 2025

@sofigio :

This is the best solution I found so far (all done as root):

Doing anything as root is, as far as I know, not the way to go with Ubuntu ...

I don't like pipx ensurepath because adding /root/.local/bin to the path seems wrong...

This does not (when not doing it as root !)

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

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants