{"id":1629,"library":"pipx","title":"pipx: Install and Run Python Applications in Isolated Environments","description":"pipx (Python Package Installer for Executables) is a tool to install and run Python applications in isolated environments. It ensures that executable applications installed via pip do not interfere with your system's global Python environment or other projects. It's currently at version 1.11.1 and follows an active, irregular release cadence, often aligning with important bug fixes or Python version support changes. pipx is primarily a command-line interface tool.","status":"active","version":"1.11.1","language":"en","source_language":"en","source_url":"https://github.com/pypa/pipx","tags":["CLI","package manager","environment management","tools","virtual environment"],"install":[{"cmd":"pip install pipx","lang":"bash","label":"Install pipx"}],"dependencies":[],"imports":[],"quickstart":{"code":"import subprocess\nimport sys\nimport os\n\n# This quickstart demonstrates installing an application via pipx.\n# pipx is primarily a command-line tool, so interaction is via subprocess calls.\n\n# 1. Ensure pipx itself is installed\nprint(\"Ensuring pipx is installed...\")\nsubprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"pipx\"], check=True, capture_output=True)\nprint(\"pipx ensured to be installed.\")\n\n# 2. Install a sample application (e.g., 'cowsay')\napp_name = \"cowsay\"\nprint(f\"\\nAttempting to install '{app_name}' with pipx...\")\ntry:\n    subprocess.run([\"pipx\", \"install\", app_name], check=True, capture_output=True)\n    print(f\"'{app_name}' installed successfully.\")\nexcept subprocess.CalledProcessError as e:\n    if \"is already installed\" in e.stderr.decode():\n        print(f\"'{app_name}' was already installed. Proceeding.\")\n    else:\n        print(f\"Error installing {app_name}: {e.stderr.decode()}\")\n        sys.exit(1)\n\n# 3. Run the installed application\nmessage = \"Hello from checklist.day's pipx quickstart!\"\nprint(f\"\\nRunning '{app_name}' via pipx...\")\ntry:\n    # Use 'pipx run' for demonstration, which temporarily adds to PATH\n    # and executes. For persistently installed apps, users would typically\n    # run 'cowsay <message>' directly after 'pipx ensurepath'.\n    result = subprocess.run([\"pipx\", \"run\", app_name, message], capture_output=True, text=True, check=True)\n    print(result.stdout)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running {app_name}: {e.stderr.decode()}\")\n    sys.exit(1)\n\n# 4. List installed applications and uninstall\nprint(\"\\nListing pipx installed applications:\")\nsubprocess.run([\"pipx\", \"list\"], check=True)\n\nprint(f\"\\nUninstalling '{app_name}'...\")\nsubprocess.run([\"pipx\", \"uninstall\", app_name], check=True, capture_output=True)\nprint(f\"'{app_name}' uninstalled successfully.\")","lang":"python","description":"This quickstart demonstrates the core workflow of pipx: installing pipx itself, then using it to install a sample CLI application (cowsay), running it, listing installed applications, and finally uninstalling it. All interactions are done by calling pipx as a command-line tool via subprocess, reflecting its primary mode of use."},"warnings":[{"fix":"Ensure your system's Python is 3.9 or newer before installing/upgrading pipx.","message":"As of pipx version 1.11.0, support for Python versions older than 3.9 has been dropped. If your primary Python environment is older than 3.9, you will need to upgrade Python or use an older pipx version (not recommended for security and features).","severity":"breaking","affected_versions":"1.11.0+"},{"fix":"Execute `pipx ensurepath` after installation and restart your terminal or shell.","message":"After installing pipx itself, or an application with pipx, you often need to run `pipx ensurepath` to add pipx's applications directory to your system's PATH. If you don't, applications installed by pipx might not be directly runnable from your shell until you do so and restart your shell.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand that pipx applications live in their own venvs. Use `pipx list` to see them and `pipx run <app>` to execute, or `pipx ensurepath` for direct execution.","message":"pipx installs applications into isolated virtual environments, preventing dependency conflicts. This differs from `pip install --user`, which installs into your user's site-packages globally. Consequently, pipx-installed applications are not available in your global Python environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Choose `pipx install` for persistent applications and `pipx run` for ephemeral, single-use executions.","message":"The `pipx run <package>` command executes a Python application from a temporary environment and cleans up afterward. Use this for one-off executions. For applications you intend to use repeatedly and have available persistently in your PATH, use `pipx install <package>`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}