2013-01-18 22:25:15 +01:00
|
|
|
.. _`Installation`:
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2020-02-11 12:37:58 +01:00
|
|
|
============
|
2013-01-18 22:25:15 +01:00
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Do I need to install pip?
|
2020-02-11 14:00:03 +01:00
|
|
|
=========================
|
2013-02-11 07:44:09 +01:00
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4
|
|
|
|
downloaded from `python.org <https://www.python.org>`_ or if you are working
|
|
|
|
in a :ref:`Virtual Environment <pypug:Creating and using Virtual Environments>`
|
2020-11-13 20:56:01 +01:00
|
|
|
created by :ref:`pypug:virtualenv` or :ref:`venv <pypug:venv>`. Just make sure
|
|
|
|
to :ref:`upgrade pip <Upgrading pip>`.
|
|
|
|
|
|
|
|
Use the following command to check whether pip is installed:
|
|
|
|
|
|
|
|
.. tab:: Unix/macOS
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
$ python -m pip --version
|
|
|
|
pip X.Y.Z from .../site-packages/pip (python X.Y)
|
|
|
|
|
|
|
|
.. tab:: Windows
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
C:\> py -m pip --version
|
|
|
|
pip X.Y.Z from ...\site-packages\pip (python X.Y)
|
|
|
|
|
|
|
|
Using Linux Package Managers
|
|
|
|
============================
|
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
If you installed Python from a package manager on Linux, you should always
|
|
|
|
install pip for that Python installation using the same source.
|
|
|
|
|
|
|
|
See `pypug:Installing pip/setuptools/wheel with Linux Package Managers <https://packaging.python.org/guides/installing-using-linux-tools/>`_
|
|
|
|
in the Python Packaging User Guide.
|
|
|
|
|
|
|
|
Here are ways to contact a few Linux package maintainers if you run into
|
|
|
|
problems:
|
|
|
|
|
|
|
|
* `Deadsnakes PPA <https://github.com/deadsnakes/issues>`_
|
|
|
|
* `Debian Python Team <https://wiki.debian.org/Teams/PythonTeam>`_ (for general
|
|
|
|
issues related to ``apt``)
|
|
|
|
* `Red Hat Bugzilla <https://bugzilla.redhat.com/>`_
|
|
|
|
|
|
|
|
pip developers do not have control over how Linux distributions handle pip
|
|
|
|
installations, and are unable to provide solutions to related issues in
|
|
|
|
general.
|
|
|
|
|
|
|
|
Using ensurepip
|
|
|
|
===============
|
|
|
|
|
|
|
|
Python >=3.4 can self-bootstrap pip with the built-in
|
|
|
|
:ref:`ensurepip <pypug:ensurepip>` module. Refer to the standard library
|
|
|
|
documentation for more details. Make sure to :ref:`upgrade pip <Upgrading pip>`
|
|
|
|
after ``ensurepip`` installs pip.
|
|
|
|
|
|
|
|
See the `Using Linux Package Managers`_ section if your Python reports
|
|
|
|
``No module named ensurepip`` on Debian and derived systems (e.g. Ubuntu).
|
2013-03-12 06:02:39 +01:00
|
|
|
|
|
|
|
|
2014-01-10 05:13:30 +01:00
|
|
|
.. _`get-pip`:
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Installing with get-pip.py
|
2020-02-11 14:00:03 +01:00
|
|
|
==========================
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2020-11-13 20:56:01 +01:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
Be cautious if you are using a Python install that is managed by your operating
|
|
|
|
system or another package manager. ``get-pip.py`` does not coordinate with
|
|
|
|
those tools, and may leave your system in an inconsistent state.
|
|
|
|
|
|
|
|
To manually install pip, securely [1]_ download ``get-pip.py`` by following
|
2019-10-16 02:09:07 +02:00
|
|
|
this link: `get-pip.py
|
|
|
|
<https://bootstrap.pypa.io/get-pip.py>`_. Alternatively, use ``curl``::
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2019-10-16 02:09:07 +02:00
|
|
|
Then run the following command in the folder where you
|
2020-08-07 20:14:23 +02:00
|
|
|
have downloaded ``get-pip.py``:
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python get-pip.py
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py get-pip.py
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
``get-pip.py`` also installs :ref:`pypug:setuptools` [2]_ and :ref:`pypug:wheel`
|
2017-07-27 21:04:04 +02:00
|
|
|
if they are not already. :ref:`pypug:setuptools` is required to install
|
2015-09-08 01:56:10 +02:00
|
|
|
:term:`source distributions <pypug:Source Distribution (or "sdist")>`. Both are
|
2017-07-27 21:04:04 +02:00
|
|
|
required in order to build a :ref:`Wheel cache` (which improves installation
|
2015-09-08 01:56:10 +02:00
|
|
|
speed), although neither are required to install pre-built :term:`wheels
|
|
|
|
<pypug:Wheel>`.
|
|
|
|
|
2016-07-17 11:55:48 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The get-pip.py script is supported on the same python version as pip.
|
2017-03-18 19:42:11 +01:00
|
|
|
For the now unsupported Python 2.6, alternate script is available
|
2016-11-07 00:48:35 +01:00
|
|
|
`here <https://bootstrap.pypa.io/2.6/get-pip.py>`__.
|
2016-07-17 11:55:48 +02:00
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
|
|
|
|
get-pip.py options
|
2020-02-11 14:00:03 +01:00
|
|
|
------------------
|
2015-09-08 01:56:10 +02:00
|
|
|
|
|
|
|
.. option:: --no-setuptools
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
If set, do not attempt to install :ref:`pypug:setuptools`
|
2015-09-08 01:56:10 +02:00
|
|
|
|
|
|
|
.. option:: --no-wheel
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
If set, do not attempt to install :ref:`pypug:wheel`
|
2015-09-08 01:56:10 +02:00
|
|
|
|
2014-04-10 01:53:52 +02:00
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
``get-pip.py`` allows :ref:`pip install options <pip
|
2014-04-10 01:53:52 +02:00
|
|
|
install Options>` and the :ref:`general options <General Options>`. Below are
|
|
|
|
some examples:
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2020-08-07 20:14:23 +02:00
|
|
|
Install from local copies of pip and setuptools:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python get-pip.py --no-index --find-links=/local/copies
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py get-pip.py --no-index --find-links=/local/copies
|
2020-08-07 20:14:23 +02:00
|
|
|
|
|
|
|
Install to the user site [3]_:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python get-pip.py --user
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py get-pip.py --user
|
2020-08-07 20:14:23 +02:00
|
|
|
|
|
|
|
Install behind a proxy:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python get-pip.py --proxy="http://[user:passwd@]proxy.server:port"
|
2011-04-04 16:45:07 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2013-08-29 05:43:20 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py get-pip.py --proxy="http://[user:passwd@]proxy.server:port"
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2018-03-17 12:23:47 +01:00
|
|
|
``get-pip.py`` can also be used to install a specified combination of ``pip``,
|
2020-08-07 20:14:23 +02:00
|
|
|
``setuptools``, and ``wheel`` using the same requirements syntax as pip:
|
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python get-pip.py pip==9.0.2 wheel==0.30.0 setuptools==28.8.0
|
2020-08-07 20:14:23 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2018-03-17 12:23:47 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2018-03-17 12:23:47 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py get-pip.py pip==9.0.2 wheel==0.30.0 setuptools==28.8.0
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2015-09-12 05:24:44 +02:00
|
|
|
.. _`Upgrading pip`:
|
|
|
|
|
|
|
|
Upgrading pip
|
2020-02-11 14:00:03 +01:00
|
|
|
=============
|
2014-03-26 19:05:23 +01:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Unix/macOS
|
2020-07-20 05:56:47 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-07-20 05:56:47 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
python -m pip install -U pip
|
2020-07-20 05:56:47 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. tab:: Windows
|
2020-07-30 09:03:16 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
.. code-block:: shell
|
2020-07-30 09:03:16 +02:00
|
|
|
|
2020-10-18 19:12:24 +02:00
|
|
|
py -m pip install -U pip
|
2014-03-26 19:05:23 +01:00
|
|
|
|
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
.. _compatibility-requirements:
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Python and OS Compatibility
|
2020-02-11 14:00:03 +01:00
|
|
|
===========================
|
2014-03-26 19:05:23 +01:00
|
|
|
|
2019-10-15 19:06:29 +02:00
|
|
|
pip works with CPython versions 2.7, 3.5, 3.6, 3.7, 3.8 and also PyPy.
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2017-03-18 19:42:11 +01:00
|
|
|
This means pip works on the latest patch version of each of these minor
|
|
|
|
versions. Previous patch versions are supported on a best effort approach.
|
2016-01-03 23:44:40 +01:00
|
|
|
|
2016-11-06 18:24:43 +01:00
|
|
|
pip works on Unix/Linux, macOS, and Windows.
|
2011-04-04 17:37:30 +02:00
|
|
|
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2014-03-26 19:05:23 +01:00
|
|
|
----
|
2013-02-11 07:44:09 +01:00
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [1] "Secure" in this context means using a modern browser or a
|
2019-09-24 14:01:33 +02:00
|
|
|
tool like ``curl`` that verifies SSL certificates when downloading from
|
2013-08-29 05:43:20 +02:00
|
|
|
https URLs.
|
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [2] Beginning with pip v1.5.1, ``get-pip.py`` stopped requiring setuptools to
|
2014-02-12 07:13:03 +01:00
|
|
|
be installed first.
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [3] The pip developers are considering making ``--user`` the default for all
|
2014-04-10 01:53:52 +02:00
|
|
|
installs, including ``get-pip.py`` installs of pip, but at this time,
|
|
|
|
``--user`` installs for pip itself, should not be considered to be fully
|
|
|
|
tested or endorsed. For discussion, see `Issue 1668
|
|
|
|
<https://github.com/pypa/pip/issues/1668>`_.
|