Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions docs/html/cli/pip_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,24 @@ Examples
py -m pip install "SomePackage==1.0.4" # specific version
py -m pip install "SomePackage>=1.0.4" # minimum version

#. Install packages into a custom target directory.

This is useful when working with embedded or custom Python distributions
where virtual environments are not practical.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, this is a bad example. It suggests that --target is suited for installing packages into an existing Python installation, and that isn't the case. The intended use for --target is in embedding scenarios, where you create a brand new, empty directory, and use pip install --target to install requirements into that directory. Your embedded application can then add the directory to the Python interpreter's path.

Using --target to install into an existing site-packages directory may work, but it's very much a "use at your own risk" scenario, and not one that we want to encourage.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification. I've updated the example to use an initially empty
directory and clarified that the intended use case is embedding scenarios.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that's a lot better.

I'm still not sure we even want to make the --target option "more discoverable", to be honest. So I'll leave it up to the other maintainers to comment, and decide whether to merge this.

Copy link
Contributor

@henryiii henryiii Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I've used --target for is creating zipapp's: https://github.com/scikit-hep/particle/blob/8ffe2da9151aedf8f15d49a07ccf3401b7815aef/noxfile.py#L55-L91 creates particle.pyz.

Basically you create a dir, install pure Python dependencies with --target, then zip it with python -m zippapp.


.. tab:: Unix/macOS

.. code-block:: shell

python -m pip install requests numpy \
--target ./extern/python_deps

.. tab:: Windows

.. code-block:: shell

py -m pip install requests numpy ^
--target .\extern\python_deps

#. Install a list of requirements specified in a file. See the :ref:`Requirements files <Requirements Files>`.

Expand Down