11/30/2021

Setuptools

See the Installation Instructions in the Python PackagingUser's Guide for instructions on installing, upgrading, and uninstallingSetuptools.

Apr 30, 2021 The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the setup script is to describe your module distribution to the Distutils, so that the various commands that operate on your modules do the right thing.

Questions and comments should be directed to the distutils-sigmailing list.Bug reports and especially tested patches may besubmitted directly to the bug tracker.

  • Jul 03, 2020 setuptools.Command is a subclass of distutils.cmd.Command, so while it may seem different, it's actually the same with some small changes.
  • Setuptools is a collection of enhancements to the Python distutils that allow developers to more easily build and distribute Python packages, especially ones that have dependencies on other packages. Packages built and distributed using setuptools look to the user like ordinary Python packages based on the distutils.

To report a security vulnerability, please use theTidelift security contact.Tidelift will coordinate the fix and disclosure.

For Enterprise

Available as part of the Tidelift Subscription.

Setuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.

Learn more.

Code of Conduct

Everyone interacting in the setuptools project's codebases, issue trackers,chat rooms, and mailing lists is expected to follow thePyPA Code of Conduct.

Do I need to install pip?¶

pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4downloaded from python.org or if you are workingin a Virtual Environmentcreated by virtualenv or venv. Just make sureto upgrade pip.

Use the following command to check whether pip is installed:

Using Linux Package Managers¶

Warning

If you installed Python from a package manager on Linux, you should alwaysinstall pip for that Python installation using the same source.

See pypug:Installing pip/setuptools/wheel with Linux Package Managersin the Python Packaging User Guide.

Here are ways to contact a few Linux package maintainers if you run intoproblems:

  • Debian Python Team (for generalissues related to apt)

pip developers do not have control over how Linux distributions handle pipinstallations, and are unable to provide solutions to related issues ingeneral.

Using ensurepip¶

Python >=3.4 can self-bootstrap pip with the built-inensurepip module. Refer to the standard librarydocumentation for more details. Make sure to upgrade pipafter ensurepip installs pip.

See the Using Linux Package Managers section if your Python reportsNomodulenamedensurepip on Debian and derived systems (e.g. Ubuntu).

SetuptoolsModule

Installing with get-pip.py¶

Warning

Be cautious if you are using a Python install that is managed by your operatingsystem or another package manager. get-pip.py does not coordinate withthose tools, and may leave your system in an inconsistent state.

To manually install pip, securely 1 download get-pip.py by followingthis link: get-pip.py. Alternatively, use curl:

Then run the following command in the folder where youhave downloaded get-pip.py:

get-pip.py also installs setuptools2 and wheelif they are not already. setuptools is required to installsource distributions. Both arerequired in order to build a Wheel Cache (which improves installationspeed), although neither are required to install pre-built wheels.

Note

The get-pip.py script is supported on the same python version as pip.For the now unsupported Python 2.6, alternate script is availablehere.

get-pip.py options¶

--no-setuptools

If set, do not attempt to install setuptools

--no-wheel

If set, do not attempt to install wheel

get-pip.py allows pip install options and the general options. Below aresome examples:

Install from local copies of pip and setuptools:

Install to the user site 3:

Install behind a proxy:

Setuptools Find_packages

Setuptools Ext_modules

get-pip.py can also be used to install a specified combination of pip,setuptools, and wheel using the same requirements syntax as pip:

Setuptools

Upgrading pip¶

Python and OS Compatibility¶

Setuptools

pip works with CPython versions 3.6, 3.7, 3.8, 3.9 and also PyPy.

This means pip works on the latest patch version of each of these minorversions. Previous patch versions are supported on a best effort approach.

pip works on Unix/Linux, macOS, and Windows.

1

Setuptools Api

“Secure” in this context means using a modern browser or atool like curl that verifies SSL certificates when downloading fromhttps URLs.

2

Beginning with pip v1.5.1, get-pip.py stopped requiring setuptools tobe installed first.

3

Setuptoolsools

The pip developers are considering making --user the default for allinstalls, including get-pip.py installs of pip, but at this time,--user installs for pip itself, should not be considered to be fullytested or endorsed. For discussion, see Issue 1668.