Inject packages

Add extra packages into an existing pipx-managed environment with pipx inject.

Inject a package

Add matplotlib to the ipython environment:

$ pipx inject ipython matplotlib

Inject several at once, from a requirements file, or both:

$ pipx inject ipython matplotlib pandas
$ pipx inject ipython -r useful-packages.txt
$ pipx inject ipython extra-pkg -r more-packages.txt

Scripts can request the versioned result envelope from either command:

$ pipx inject ipython matplotlib --output json
$ pipx uninject ipython matplotlib --output json

Expose injected apps

Injected packages do not add their entry points to your PATH by default. Use --include-apps to expose them:

$ pipx inject ipython black --include-apps

--include-deps exposes apps and manual pages from every dependency. Use --include-resources-from PACKAGE to expose one dependency, repeating it to select more. Both options imply --include-apps.

$ pipx inject robotframework-keyta robotframework-browser-batteries --include-resources-from robotframework-browser

For exposing apps from an already-installed environment, see Expose apps.

Other flags

  • --force / -f reinstalls the package even when it is already injected.

  • --editable / -e installs the package in editable (development) mode.

  • --with-suffix targets a suffixed venv (for example ipython_3.11).

  • --pip-args passes extra arguments to pip (for example --pip-args='--no-cache-dir').

  • --index-url / -i sets the package index URL for this inject.

  • --system-site-packages gives the venv access to the system site-packages.

Verify it

$ pipx list --include-injected

The injected packages appear under their host environment.