Skip to main content

Install and Run Python Applications in Isolated Environments

Project description

pipx — Install and Run Python Applications in Isolated Environments

Documentation: https://pipxproject.github.io/pipx/

Source Code: https://github.com/pipxproject/pipx

For comparison to other tools including pipsi, see the comparisons.

Install pipx

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

For more details, installation.

To add shell completions, see instructions with

pipx completions

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 kind of like macOS's brew (if you are familiar with that), but for Python applications.

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 the 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 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? 😄).

pipx is similar to JavaScript's npx - which ships with npm, but also allows you to install instead of just run. pipx does not ship with pip but installing it is often an important part of bootstrapping your system.

Safely installing to isolated environments

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.

Example:

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


>> pycowsay mooo
  ____
< mooo >
  ====
         \
          \
            ^__^
            (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


Running in temporary, sandboxed environments

pipx makes running the latest version of a program in a temporary environment as easy as

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. These caches last two days.

I find this handy when I want to quickly see the help text of an application, or when I occasionally run an app but don't necessarily want it hanging around on my system. A nice side benefit is that you don't have to remember to upgrade it since pipx run will automatically run a recent version for you.

You can run .py files directly, too.

pipx run https://gist.githubusercontent.com/cs01/fa721a17a326e551ede048c5088f9e0f/raw/6bdfbb6e9c1132b1c38fdd2f195d4a24c540c324/pipx-demo.py
pipx is working!

Testimonials

"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

Credits

pipx was inspired by pipsi and npx.

Creator/Maintainer

Contributors

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pipx-0.14.0.0rc0.tar.gz (322.2 kB view details)

Uploaded Source

Built Distribution

pipx-0.14.0.0rc0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file pipx-0.14.0.0rc0.tar.gz.

File metadata

  • Download URL: pipx-0.14.0.0rc0.tar.gz
  • Upload date:
  • Size: 322.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pipx-0.14.0.0rc0.tar.gz
Algorithm Hash digest
SHA256 bbec6c3cd003f995052e1c0b50be4dc998acdf8348fc899ba044e4995e94e2d6
MD5 f505b14121804adbc6681c0232d8fc8c
BLAKE2b-256 88676ab6434012a9e87fb4f8f63b6e82e8c23af65088a11d2e4e569cc23ae981

See more details on using hashes here.

File details

Details for the file pipx-0.14.0.0rc0-py3-none-any.whl.

File metadata

  • Download URL: pipx-0.14.0.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pipx-0.14.0.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4d7352f620be1e9e73755e37725d9294d1965a1ea27885e514d8818b7eedec
MD5 62d077004688b3f9c5d861d1f09d81a7
BLAKE2b-256 4a449945c98850274c41daeaa35c24170388ec0b953cd42e57ade58c502451ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page