📅 October 31, 2020     🕐 2 minutes read

Install and Run Python Applications in Isolated Environments With pipx

pipx allows you to install and run python applications in isolated environments

pipx is a tool to install and run any of these thousands of application-containing packages in a safe, convenient, and reliable way. In a way, it turns Python Package Index (PyPI) into a big app store for Python applications.

It’s closely related to pip. In fact, it uses pip, but is focused on installing and managing Python packages that can be run from the command line directly as applications.

Best of all, pipx runs with regular user permissions. pipx never needs to run as sudo.

HOW TO INSTALL

Before you try to install pipx, make sure you have Python 3.6+, Pip and venv. But if you’re interested in reading this article, you’re probably already up to date with dependencies.

You can install pipx via pip. First run python3 -m pip install --user pipx and then run python3 -m pipx ensurepath.

macOS users can also install via Homebrew. Just run brew install pipx and then run pipx ensurepath.

On Arch Linux pipx is available IN the official repositories. So you can install it with sudo pacman -S python-pipxand then run pipx ensurepath. I can only assume pipx is also available on other distros. If it isn’t available in the official/community repos, you can always install via pip.

 

 

HOW TO USE

To install a python app run pipx install package. The default binary location for pipx-installed apps is ~/.local/bin. This can be overridden with the environment variable PIPX_BIN_DIR.

pipx’s default virtual environment location is ~/.local/pipx. This can be overridden with the environment variable PIPX_HOME.

To list all the installed apps run pipx list.

 

To uninstall an app run pipx uninstall package or pipx uninstall-all to uninstall all installed packages. If you want to run a python app without actually installing it, you can use pipx run package.

 

To reinstall a package you can run pipx reinstall packageor pipx reinstall-all to reinstall all installed packages.  Also, if you want to upgrade a package you can run pipx upgrade package or run pipx upgrade-allto upgrade all installed packages.

pipx is very well documented, so going into greater detail would be a matter or pointless copy-paste.  You can learn more about it on pipx’s Github page. Also don’t forget to run pipx --help.

 

SUPPORT

FSM has no ads or affiliate links. Your support would simply pay for our servers, domain and maintanance. If there's any leftover change, we'll get some coffee and a slice of pizza.

PayPal  
Bitcoin (BTC) 1Hfuq77gKKFJeNcq4EP4dQK3yDRWrFEwJR
Bitcoin Cash (BCH) qzmdm6e6q5wf2p6sxz2mst7cenz60newwc5m4e9js8
Ether (ETH) 0x5f02869278C24A6579d3820f52AD15936D6F9d69
Stellar (XLM) GDWT2QU2CI3GZ5XH5DTSU3IUAHZMTB6VQKKRHBYWS5YCCQOAG6OKG2OB
More content?