2014-02-12 06:55:43 +01:00
|
|
|
.. _`pip install`:
|
|
|
|
|
2020-02-11 12:37:58 +01:00
|
|
|
===========
|
2014-02-12 06:55:43 +01:00
|
|
|
pip install
|
2020-02-11 12:37:58 +01:00
|
|
|
===========
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2017-11-12 17:04:37 +01:00
|
|
|
|
2020-02-11 14:05:28 +01:00
|
|
|
|
2014-02-12 06:55:43 +01:00
|
|
|
Usage
|
2020-02-11 14:00:03 +01:00
|
|
|
=====
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
.. pip-command-usage:: install 'python -m pip'
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. pip-command-usage:: install "py -m pip"
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-02-11 14:05:28 +01:00
|
|
|
|
2014-02-12 06:55:43 +01:00
|
|
|
Description
|
2020-02-11 14:00:03 +01:00
|
|
|
===========
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
.. pip-command-description:: install
|
|
|
|
|
2015-04-01 03:39:45 +02:00
|
|
|
Overview
|
2020-02-11 14:00:03 +01:00
|
|
|
--------
|
2015-04-01 03:39:45 +02:00
|
|
|
|
2020-02-11 14:51:29 +01:00
|
|
|
pip install has several stages:
|
2015-04-01 03:39:45 +02:00
|
|
|
|
2016-01-15 16:55:48 +01:00
|
|
|
1. Identify the base requirements. The user supplied arguments are processed
|
|
|
|
here.
|
|
|
|
2. Resolve dependencies. What will be installed is determined here.
|
|
|
|
3. Build wheels. All the dependencies that can be are built into wheels.
|
|
|
|
4. Install the packages (and uninstall anything being upgraded/replaced).
|
|
|
|
|
2020-10-26 20:44:15 +01:00
|
|
|
Note that ``pip install`` prefers to leave the installed version as-is
|
|
|
|
unless ``--upgrade`` is specified.
|
|
|
|
|
2016-01-15 16:55:48 +01:00
|
|
|
Argument Handling
|
2020-02-11 14:00:03 +01:00
|
|
|
-----------------
|
2016-01-15 16:55:48 +01:00
|
|
|
|
|
|
|
When looking at the items to be installed, pip checks what type of item
|
|
|
|
each is, in the following order:
|
|
|
|
|
|
|
|
1. Project or archive URL.
|
2023-11-28 07:17:51 +01:00
|
|
|
2. Local directory (which must contain a ``pyproject.toml`` or ``setup.py``,
|
|
|
|
otherwise pip will report an error).
|
2016-01-15 16:55:48 +01:00
|
|
|
3. Local file (a sdist or wheel format archive, following the naming
|
|
|
|
conventions for those formats).
|
2018-06-25 12:43:59 +02:00
|
|
|
4. A requirement, as specified in :pep:`440`.
|
2016-01-15 16:55:48 +01:00
|
|
|
|
|
|
|
Each item identified is added to the set of requirements to be satisfied by
|
|
|
|
the install.
|
|
|
|
|
|
|
|
Working Out the Name and Version
|
2020-02-11 14:00:03 +01:00
|
|
|
--------------------------------
|
2016-01-15 16:55:48 +01:00
|
|
|
|
|
|
|
For each candidate item, pip needs to know the project name and version. For
|
|
|
|
wheels (identified by the ``.whl`` file extension) this can be obtained from
|
|
|
|
the filename, as per the Wheel spec. For local directories, or explicitly
|
|
|
|
specified sdist files, the ``setup.py egg_info`` command is used to determine
|
|
|
|
the project metadata. For sdists located via an index, the filename is parsed
|
|
|
|
for the name and project version (this is in theory slightly less reliable
|
|
|
|
than using the ``egg_info`` command, but avoids downloading and processing
|
|
|
|
unnecessary numbers of files).
|
|
|
|
|
2021-06-25 12:14:12 +02:00
|
|
|
Any URL may use the ``#egg=name`` syntax (see :doc:`../topics/vcs-support`) to
|
2016-01-18 11:14:13 +01:00
|
|
|
explicitly state the project name.
|
2016-01-15 16:55:48 +01:00
|
|
|
|
|
|
|
Satisfying Requirements
|
2020-02-11 14:00:03 +01:00
|
|
|
-----------------------
|
2016-01-15 16:55:48 +01:00
|
|
|
|
|
|
|
Once pip has the set of requirements to satisfy, it chooses which version of
|
|
|
|
each requirement to install using the simple rule that the latest version that
|
|
|
|
satisfies the given constraints will be installed (but see :ref:`here <Pre Release Versions>`
|
|
|
|
for an exception regarding pre-release versions). Where more than one source of
|
|
|
|
the chosen version is available, it is assumed that any source is acceptable
|
|
|
|
(as otherwise the versions would differ).
|
2015-04-01 03:39:45 +02:00
|
|
|
|
2022-07-01 18:18:34 +02:00
|
|
|
Obtaining information about what was installed
|
|
|
|
----------------------------------------------
|
|
|
|
|
|
|
|
The install command has a ``--report`` option that will generate a JSON report of what
|
|
|
|
pip has installed. In combination with the ``--dry-run`` and ``--ignore-installed`` it
|
|
|
|
can be used to *resolve* a set of requirements without actually installing them.
|
|
|
|
|
|
|
|
The report can be written to a file, or to standard output (using ``--report -`` in
|
|
|
|
combination with ``--quiet``).
|
|
|
|
|
|
|
|
The format of the JSON report is described in :doc:`../reference/installation-report`.
|
|
|
|
|
2015-03-25 01:53:10 +01:00
|
|
|
Installation Order
|
2020-02-11 14:00:03 +01:00
|
|
|
------------------
|
2015-03-25 01:53:10 +01:00
|
|
|
|
2019-06-16 14:57:00 +02:00
|
|
|
.. note::
|
2020-02-11 14:10:42 +01:00
|
|
|
|
2019-06-16 16:04:19 +02:00
|
|
|
This section is only about installation order of runtime dependencies, and
|
|
|
|
does not apply to build dependencies (those are specified using PEP 518).
|
2019-06-13 13:27:07 +02:00
|
|
|
|
2015-04-02 06:21:19 +02:00
|
|
|
As of v6.1.0, pip installs dependencies before their dependents, i.e. in
|
2019-05-07 15:13:56 +02:00
|
|
|
"topological order." This is the only commitment pip currently makes related
|
2015-04-02 06:21:19 +02:00
|
|
|
to order. While it may be coincidentally true that pip will install things in
|
|
|
|
the order of the install arguments or in the order of the items in a
|
|
|
|
requirements file, this is not a promise.
|
|
|
|
|
2015-04-03 06:12:52 +02:00
|
|
|
In the event of a dependency cycle (aka "circular dependency"), the current
|
|
|
|
implementation (which might possibly change later) has it such that the first
|
2015-04-02 06:21:19 +02:00
|
|
|
encountered member of the cycle is installed last.
|
2015-03-25 01:53:10 +01:00
|
|
|
|
|
|
|
For instance, if quux depends on foo which depends on bar which depends on baz,
|
2020-08-04 18:59:10 +02:00
|
|
|
which depends on foo:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: console
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
$ python -m pip install quux
|
|
|
|
...
|
|
|
|
Installing collected packages baz, bar, foo, quux
|
2015-03-25 01:53:10 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
$ python -m pip install bar
|
|
|
|
...
|
|
|
|
Installing collected packages foo, baz, bar
|
2015-03-25 01:53:10 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: console
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
C:\> py -m pip install quux
|
|
|
|
...
|
|
|
|
Installing collected packages baz, bar, foo, quux
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
C:\> py -m pip install bar
|
|
|
|
...
|
|
|
|
Installing collected packages foo, baz, bar
|
2015-03-25 01:53:10 +01:00
|
|
|
|
2015-04-02 01:57:15 +02:00
|
|
|
|
2015-04-02 06:21:19 +02:00
|
|
|
Prior to v6.1.0, pip made no commitments about install order.
|
|
|
|
|
|
|
|
The decision to install topologically is based on the principle that
|
|
|
|
installations should proceed in a way that leaves the environment usable at each
|
|
|
|
step. This has two main practical benefits:
|
|
|
|
|
|
|
|
1. Concurrent use of the environment during the install is more likely to work.
|
2015-04-03 06:12:52 +02:00
|
|
|
2. A failed install is less likely to leave a broken environment. Although pip
|
|
|
|
would like to support failure rollbacks eventually, in the mean time, this is
|
|
|
|
an improvement.
|
2015-04-02 06:21:19 +02:00
|
|
|
|
|
|
|
Although the new install order is not intended to replace (and does not replace)
|
|
|
|
the use of ``setup_requires`` to declare build dependencies, it may help certain
|
|
|
|
projects install from sdist (that might previously fail) that fit the following
|
|
|
|
profile:
|
|
|
|
|
|
|
|
1. They have build dependencies that are also declared as install dependencies
|
|
|
|
using ``install_requires``.
|
|
|
|
2. ``python setup.py egg_info`` works without their build dependencies being
|
|
|
|
installed.
|
|
|
|
3. For whatever reason, they don't or won't declare their build dependencies using
|
|
|
|
``setup_requires``.
|
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-requirements-file-format`:
|
|
|
|
.. rubric:: Requirements File Format
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2021-09-08 09:07:57 +02:00
|
|
|
This section has been moved to :doc:`../reference/requirements-file-format`.
|
2015-06-25 00:58:10 +02:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-requirement-specifiers`:
|
|
|
|
.. rubric:: Requirement Specifiers
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-11 13:17:28 +01:00
|
|
|
This section has been moved to :doc:`../reference/requirement-specifiers`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-per-requirement-overrides`:
|
|
|
|
.. rubric:: Per-requirement Overrides
|
2015-03-14 21:37:09 +01:00
|
|
|
|
2022-02-11 15:03:50 +01:00
|
|
|
This is now covered in :doc:`../reference/requirements-file-format`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
.. _`Pre Release Versions`:
|
|
|
|
|
|
|
|
Pre-release Versions
|
2020-02-11 14:00:03 +01:00
|
|
|
--------------------
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
Starting with v1.4, pip will only install stable versions as specified by
|
2018-06-25 12:43:59 +02:00
|
|
|
`pre-releases`_ by default. If a version cannot be parsed as a compliant :pep:`440`
|
2014-02-12 06:55:43 +01:00
|
|
|
version then it is assumed to be a pre-release.
|
|
|
|
|
|
|
|
If a Requirement specifier includes a pre-release or development version
|
|
|
|
(e.g. ``>=0.0.dev0``) then pip will allow pre-release and development versions
|
|
|
|
for that requirement. This does not include the != flag.
|
|
|
|
|
|
|
|
The ``pip install`` command also supports a :ref:`--pre <install_--pre>` flag
|
2018-06-14 06:37:27 +02:00
|
|
|
that enables installation of pre-releases and development releases.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
2018-06-05 16:10:25 +02:00
|
|
|
.. _pre-releases: https://www.python.org/dev/peps/pep-0440/#handling-of-pre-releases
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-vcs-support`:
|
|
|
|
.. rubric:: VCS Support
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2021-06-25 12:14:12 +02:00
|
|
|
This is now covered in :doc:`../topics/vcs-support`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
Finding Packages
|
2020-02-11 14:00:03 +01:00
|
|
|
----------------
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
pip searches for packages on `PyPI`_ using the
|
2019-05-07 20:30:39 +02:00
|
|
|
`HTTP simple interface <https://pypi.org/simple/>`_,
|
2021-09-05 06:24:08 +02:00
|
|
|
which is documented `here <https://packaging.python.org/specifications/simple-repository-api/>`_
|
2020-03-26 04:53:31 +01:00
|
|
|
and `there <https://www.python.org/dev/peps/pep-0503/>`_.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2019-05-07 15:13:56 +02:00
|
|
|
pip offers a number of package index options for modifying how packages are
|
|
|
|
found.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2019-05-07 15:13:56 +02:00
|
|
|
pip looks for packages in a number of places: on PyPI (if not disabled via
|
|
|
|
``--no-index``), in the local filesystem, and in any additional repositories
|
|
|
|
specified via ``--find-links`` or ``--index-url``. There is no ordering in
|
|
|
|
the locations that are searched. Rather they are all checked, and the "best"
|
2018-06-25 12:43:59 +02:00
|
|
|
match for the requirements (in terms of version number - see :pep:`440` for
|
2015-12-11 18:59:34 +01:00
|
|
|
details) is selected.
|
|
|
|
|
2014-02-12 06:55:43 +01:00
|
|
|
See the :ref:`pip install Examples<pip install Examples>`.
|
|
|
|
|
2022-07-29 13:39:40 +02:00
|
|
|
.. _`0-ssl certificate verification`:
|
|
|
|
.. rubric:: SSL Certificate Verification
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-07-29 13:39:40 +02:00
|
|
|
This is now covered in :doc:`../topics/https-certificates`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-caching`:
|
|
|
|
.. rubric:: Caching
|
2014-04-24 13:29:57 +02:00
|
|
|
|
2021-08-06 15:06:36 +02:00
|
|
|
This is now covered in :doc:`../topics/caching`.
|
2014-04-24 13:29:57 +02:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-wheel-cache`:
|
|
|
|
.. rubric:: Wheel Cache
|
2015-03-30 23:44:02 +02:00
|
|
|
|
2021-08-06 15:06:36 +02:00
|
|
|
This is now covered in :doc:`../topics/caching`.
|
2015-03-30 23:44:02 +02:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-hash-checking-mode`:
|
|
|
|
.. rubric:: Hash checking mode
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-11 16:06:43 +01:00
|
|
|
This is now covered in :doc:`../topics/secure-installs`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-local-project-installs`:
|
|
|
|
.. rubric:: Local Project Installs
|
2020-04-19 22:32:02 +02:00
|
|
|
|
2022-02-11 14:36:19 +01:00
|
|
|
This is now covered in :doc:`../topics/local-project-installs`.
|
2019-08-03 19:31:42 +02:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-editable-installs`:
|
|
|
|
.. rubric:: Editable installs
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-11 14:36:19 +01:00
|
|
|
This is now covered in :doc:`../topics/local-project-installs`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2022-02-18 18:48:35 +01:00
|
|
|
.. _`0-build-system-interface`:
|
|
|
|
.. rubric:: Build System Interface
|
2014-04-26 07:20:53 +02:00
|
|
|
|
2021-09-11 17:53:52 +02:00
|
|
|
This is now covered in :doc:`../reference/build-system/index`.
|
2014-04-26 07:20:53 +02:00
|
|
|
|
2014-04-09 07:57:22 +02:00
|
|
|
.. _`pip install Options`:
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
Options
|
2020-02-11 14:00:03 +01:00
|
|
|
=======
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
.. pip-command-options:: install
|
|
|
|
|
2019-11-12 23:54:43 +01:00
|
|
|
.. pip-index-options:: install
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
.. _`pip install Examples`:
|
|
|
|
|
2020-02-11 14:05:56 +01:00
|
|
|
|
2014-02-12 06:55:43 +01:00
|
|
|
Examples
|
2020-02-11 14:00:03 +01:00
|
|
|
========
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2019-09-24 14:01:33 +02:00
|
|
|
#. Install ``SomePackage`` and its dependencies from `PyPI`_ using :ref:`Requirement Specifiers`
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install SomePackage # latest version
|
2023-03-06 07:26:29 +01:00
|
|
|
python -m pip install 'SomePackage==1.0.4' # specific version
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install 'SomePackage>=1.0.4' # minimum version
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install SomePackage # latest version
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install "SomePackage==1.0.4" # specific version
|
|
|
|
py -m pip install "SomePackage>=1.0.4" # minimum version
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
2016-05-16 21:33:51 +02:00
|
|
|
#. Install a list of requirements specified in a file. See the :ref:`Requirements files <Requirements Files>`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install -r requirements.txt
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install -r requirements.txt
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
2019-09-24 14:01:33 +02:00
|
|
|
#. Upgrade an already installed ``SomePackage`` to the latest from PyPI.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install --upgrade SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install --upgrade SomePackage
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2021-03-05 17:52:30 +01:00
|
|
|
.. note::
|
|
|
|
|
2021-03-05 17:58:38 +01:00
|
|
|
This will guarantee an update to ``SomePackage`` as it is a direct
|
|
|
|
requirement, and possibly upgrade dependencies if their installed
|
|
|
|
versions do not meet the minimum requirements of ``SomePackage``.
|
|
|
|
Any non-requisite updates of its dependencies (indirect requirements)
|
|
|
|
will be affected by the ``--upgrade-strategy`` command.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2016-05-16 21:33:51 +02:00
|
|
|
#. Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install -e . # project in current directory
|
|
|
|
python -m pip install -e path/to/project # project in another directory
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install -e . # project in current directory
|
|
|
|
py -m pip install -e path/to/project # project in another directory
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
2020-07-17 22:07:32 +02:00
|
|
|
#. Install a project from VCS
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
python -m pip install 'SomeProject@git+https://git.repo/some_pkg.git@1.3.1'
|
2020-07-17 22:07:32 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install "SomeProject@git+https://git.repo/some_pkg.git@1.3.1"
|
2020-07-17 22:07:32 +02:00
|
|
|
|
|
|
|
|
2021-06-25 12:14:12 +02:00
|
|
|
#. Install a project from VCS in "editable" mode. See the sections on :doc:`../topics/vcs-support` and :ref:`Editable Installs <editable-installs>`.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
python -m pip install -e 'git+https://git.repo/some_pkg.git#egg=SomePackage' # from git
|
|
|
|
python -m pip install -e 'hg+https://hg.repo/some_pkg.git#egg=SomePackage' # from mercurial
|
|
|
|
python -m pip install -e 'svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage' # from svn
|
|
|
|
python -m pip install -e 'git+https://git.repo/some_pkg.git@feature#egg=SomePackage' # from 'feature' branch
|
|
|
|
python -m pip install -e 'git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path' # install a python package from a repo subdirectory
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install -e "git+https://git.repo/some_pkg.git#egg=SomePackage" # from git
|
|
|
|
py -m pip install -e "hg+https://hg.repo/some_pkg.git#egg=SomePackage" # from mercurial
|
|
|
|
py -m pip install -e "svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage" # from svn
|
|
|
|
py -m pip install -e "git+https://git.repo/some_pkg.git@feature#egg=SomePackage" # from 'feature' branch
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install -e "git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path" # install a python package from a repo subdirectory
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2021-11-05 10:40:09 +01:00
|
|
|
#. Install a package with `extras`_.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-02-21 03:25:04 +01:00
|
|
|
python -m pip install 'SomePackage[PDF]'
|
|
|
|
python -m pip install 'SomePackage[PDF] @ git+https://git.repo/SomePackage@main#subdirectory=subdir_path'
|
|
|
|
python -m pip install '.[PDF]' # project in current directory
|
|
|
|
python -m pip install 'SomePackage[PDF]==3.0'
|
|
|
|
python -m pip install 'SomePackage[PDF,EPUB]' # multiple extras
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2023-02-21 03:25:04 +01:00
|
|
|
py -m pip install "SomePackage[PDF]"
|
2021-03-28 08:29:37 +02:00
|
|
|
py -m pip install "SomePackage[PDF] @ git+https://git.repo/SomePackage@main#subdirectory=subdir_path"
|
2023-02-21 03:25:04 +01:00
|
|
|
py -m pip install ".[PDF]" # project in current directory
|
|
|
|
py -m pip install "SomePackage[PDF]==3.0"
|
|
|
|
py -m pip install "SomePackage[PDF,EPUB]" # multiple extras
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2016-05-16 21:33:51 +02:00
|
|
|
#. Install a particular source archive file.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
python -m pip install './downloads/SomePackage-1.0.4.tar.gz'
|
|
|
|
python -m pip install 'http://my.package.repo/SomePackage-1.0.4.zip'
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install "./downloads/SomePackage-1.0.4.tar.gz"
|
|
|
|
py -m pip install "http://my.package.repo/SomePackage-1.0.4.zip"
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2019-02-23 19:10:34 +01:00
|
|
|
#. Install a particular source archive file following :pep:`440` direct references.
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
python -m pip install 'SomeProject@http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl'
|
|
|
|
python -m pip install 'SomeProject @ http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl'
|
|
|
|
python -m pip install 'SomeProject@http://my.package.repo/1.2.3.tar.gz'
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2019-02-23 19:10:34 +01:00
|
|
|
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install "SomeProject@http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl"
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install "SomeProject @ http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl"
|
2023-03-06 07:26:29 +01:00
|
|
|
py -m pip install "SomeProject@http://my.package.repo/1.2.3.tar.gz"
|
2019-02-23 19:10:34 +01:00
|
|
|
|
2016-05-16 21:33:51 +02:00
|
|
|
#. Install from alternative package repositories.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-08-04 18:59:10 +02:00
|
|
|
Install from a different index, and not `PyPI`_
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install --index-url http://my.package.repo/simple/ SomePackage
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install --index-url http://my.package.repo/simple/ SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
Install from a local flat directory containing archives (and don't scan indexes):
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
python -m pip install --no-index --find-links=file:///local/dir/ SomePackage
|
|
|
|
python -m pip install --no-index --find-links=/local/dir/ SomePackage
|
|
|
|
python -m pip install --no-index --find-links=relative/dir/ SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
py -m pip install --no-index --find-links=file:///local/dir/ SomePackage
|
|
|
|
py -m pip install --no-index --find-links=/local/dir/ SomePackage
|
|
|
|
py -m pip install --no-index --find-links=relative/dir/ SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
Search an additional index during install, in addition to `PyPI`_
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
Using this option to search for packages which are not in the main
|
|
|
|
repository (such as private packages) is unsafe, per a security
|
|
|
|
vulnerability called
|
|
|
|
`dependency confusion <https://azure.microsoft.com/en-us/resources/3-ways-to-mitigate-risk-using-private-package-feeds/>`_:
|
|
|
|
an attacker can claim the package on the public repository in a way that
|
|
|
|
will ensure it gets chosen over the private package.
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
python -m pip install --extra-index-url http://my.package.repo/simple SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2021-04-03 10:41:04 +02:00
|
|
|
py -m pip install --extra-index-url http://my.package.repo/simple SomePackage
|
2014-02-12 06:55:43 +01:00
|
|
|
|
|
|
|
|
2016-05-16 21:33:51 +02:00
|
|
|
#. Find pre-release and development versions, in addition to stable versions. By default, pip only finds stable versions.
|
2014-02-12 06:55:43 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install --pre SomePackage
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install --pre SomePackage
|
2015-05-31 01:44:01 +02:00
|
|
|
|
2020-03-29 13:18:32 +02:00
|
|
|
|
|
|
|
#. Install packages from source.
|
|
|
|
|
2020-08-04 18:59:10 +02:00
|
|
|
Do not use any binary packages
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install SomePackage1 SomePackage2 --no-binary :all:
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install SomePackage1 SomePackage2 --no-binary :all:
|
2020-08-04 18:59:10 +02:00
|
|
|
|
|
|
|
Specify ``SomePackage1`` to be installed from source:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-04 18:59:10 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install SomePackage1 SomePackage2 --no-binary SomePackage1
|
2020-03-29 13:18:32 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-03-29 13:18:32 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-03-29 13:18:32 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install SomePackage1 SomePackage2 --no-binary SomePackage1
|
2020-03-29 13:18:32 +02:00
|
|
|
|
2021-11-05 10:40:09 +01:00
|
|
|
.. _extras: https://www.python.org/dev/peps/pep-0508/#extras
|
2021-09-11 17:53:52 +02:00
|
|
|
.. _PyPI: https://pypi.org/
|