Raspberry Pi

How to Install Pipx on Raspberry Pi

pipx is a package management tool that allows users to install Python applications that can easily run from the command-line interface. It’s different from “pip” since it adds an isolated environment to the system and ensures that installed applications can easily run on your system. On the other hand, “pip” doesn’t have any isolated environment; however, it’s useful for users who want to install Python libraries and dependencies.

This article is an easy guide to install pipx on the Raspberry Pi.

Install pipx on Raspberry Pi

There are two methods to install pipx on Raspberry Pi:

Method 1: Install pipx Through Default Raspberry Pi Repository

You can directly install pipx on Raspberry Pi from system repository through below-given command:

$ sudo apt install pipx -y

After the installation, check pipx version using the following command:

$ pipx --version

Remove pipx from Raspberry Pi

You can remove pipx installed from Raspberry Pi repository using the following command:

$ sudo apt remove pipx -y

Method 2: Install pipx Through pip

The above method installs the pipx older version on the Raspberry Pi system. However, you can install latest version of pipx on Raspberry Pi through pip using the following command:

$ pip install pipx

Note: You can install pip on the Raspberry Pi system from here.

Before running the “pipx” version command, you can to set the Path variable inside the following file:

$ nano ~/.bashrc

Inside this file, add the line given below at the end:

export PATH="$PATH:$HOME/.local/bin"

Save this file using “CTRL+X”, add “Y” and press enter to exit.

To apply the above changes, hit the following command:

$ source .bashrc

You can now check pipx version using the following command to confirm its installation on Raspberry Pi system:

$ pipx --version

Install Application Through pipx

You can install the application through pipx in the same way as you do via pip. Follow the below-given command if you want to install the QRCode application on your Raspberry Pi system.

$ pipx install qrcode

Remove pipx from Raspberry Pi

Execute the following command to remove pipx from Raspberry Pi installed from pip.

$ pip uninstall pipx

Enter “y” to confirm removing pipx from the Raspberry Pi system.

Conclusion

pipx is a Python package management tool for installing Python applications that can run from the terminal. You can install this tool on Raspberry Pi with the “apt” command or pip installer. The “apt” command installs an older version of pipx, while pip installs the latest version of it on the Raspberry Pi system. However, for pipx installation through pip, you must add a path variable to run the pipx-related commands in the terminal.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.