Skip to main content

Install and Run Python Applications in Isolated Environments

Project description

pipx — Install and Run Python Applications in Isolated Environments

Code style: black


Source Code:

For comparison to other tools including pipsi, see Comparison to Other Tools.

Install pipx

python3 -m pip install --user pipx
python3 -m pipx ensurepath

Upgrade pipx with python3 -m pip install -U pipx.

Shell completions are available by following the instructions printed with this command:

pipx completions

For more details, see the installation instructions.

Overview: What is pipx?

pipx is a tool to help you install and run end-user applications written in Python. pipx is not a tool for development or publishing of your code -- it's only for consuming already published packages.

If you are familiar macOS's brew, it's kind of like that but for Python applications. If you are familiar with JavaScript's npx, it's kind of like that but also allows you to install packages. If you are familiar with pip, it's kind of like that but is only focused on installing packages that have entry points.

pipx does not ship with pip, but installing it is often an important part of bootstrapping your system.

Python and PyPI allow developers to distribute code with "console script entry points". These scripts let users call into Python code from the command line, effectively acting like standalone applications. pipx is a tool to install and run any of these thousands of Python applications available on PyPI in a safe, convenient, and reliable way. In a way, it turns Python Package Index (PyPI) into a big app store for Python applications. Not all Python packages have entry points, but many do. pipx is not a tool to install a library and import it in your Python code.

pipx enables you to:

  • Safely install packages to isolated environments, while globally exposing their CLI entry points so you can run them from anywhere (see the install command). This guarantees no dependency conflicts and clean uninstalls!
  • Easily list, upgrade, and uninstall packages that were installed with pipx
  • Run the latest version of a Python application in a temporary environment (see the run command)

Best of all, pipx runs with regular user permissions, never calling sudo pip install (you aren't doing that, are you? 😄).

Walkthrough: Installing a Package and its Applications With pipx

You can globally install an application by running

pipx install PACKAGE

This automatically creates a virtual environment, installs the package, and adds the package's associated applications (entry points) to a location on your PATH. For example, pipx install pycowsay makes the pycowsay command available globally, but sandboxes the pycowsay package in its own virtual environment. pipx never needs to run as sudo to do this.


>> pipx install pycowsay
  installed package pycowsay 2.0.3, Python 3.7.3
  These apps are now globally available
    - pycowsay
done! ✨ 🌟 ✨

>> pipx list
venvs are in /home/user/.local/pipx/venvs
apps are exposed on your $PATH at /home/user/.local/bin
   package pycowsay 2.0.3, Python 3.7.3
    - pycowsay

# Now you can run pycowsay from anywhere
>> pycowsay mooo
< mooo >
            (__)\       )\/\
                ||----w |
                ||     ||

Walkthrough: Running an Application in a Temporary, Sandboxed Environment

I find this handy when I occasionally run an app and want to use the latest version of it, but don't necessarily need it installed on my computer. You may want to do this when you are initializing a new project and want to set up the right directory structure, when you want to view the help text of an application, or if you simply want to run an app in a one-off case.

For example, the blog post How to set up a perfect Python project uses pipx run to kickstart a new project withcookiecutter.

A nice side benefit is that you don't have to remember to upgrade the app it since pipx run will automatically run a recent version for you.

Okay, let's see what this looks like in practice!

pipx run APP [ARGS...]

This will install the package in an isolated, temporary directory and invoke the app. Try it!

pipx run pycowsay moo

Notice that you don't need to execute any install commands to run the app.

Re-running the same app is quick because pipx caches Virtual Environments on a per-app basis. The caches only last a few days, and when they expire, pipx will again use the latest version of the package. This way you can be sure you're always running a new version of the package without having to manually upgrade.

You can run .py files directly, too.

pipx run
pipx is working!


"I'm a big fan of pipx. I think pipx is super cool."

Michael Kennedy, co-host of PythonBytes podcast in episode 139

"Thanks for improving the workflow that pipsi has covered in the past. Nicely done!"

Jannis Leidel, PSF fellow and former pip maintainer

"This tool filled in the gap that was missing with pipenv and Virtual Environmentwrapper."

—Mason Egger in a blog post


pipx was inspired by pipsi and npx.



Logo by @IrishMorales.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipx- (323.8 kB view hashes)

Uploaded source

Built Distribution

pipx- (25.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page