Intrastellar Explorer
Intrastellar Explorer

Reputation: 2411

Is setuptools always installed in Python by default?

Is setuptools always installed with Python?

I would like to invoke setuptools at runtime outside of a setup.py script.

In other words, should I include setuptools inside my package's requirements.txt and setup.py's install_requires list?


Background

I have noticed when creating a new virtual environment (with Python 3.7.9) that both pip and setuptools are installed by default:

python -m venv venv
source ./venv/bin/activate
pip list

Package    Version
---------- -------
pip        20.1.1
setuptools 47.1.0

This is documented here: Creating Virtual Environments:

venv is available by default in Python 3.3 and later, and installs pip and setuptools into created virtual environments in Python 3.4 and later.

Even in a vanilla version of Python 3.7.6 (installed via pyenv), the packages installed by default are both pip and setuptools.


Research

Should setuptools be included in setup_requires in Python?

Informs that setuptools should not be included in setup_requires, but does not talk about it being included in package requirements for runtime use.

Upvotes: 8

Views: 5581

Answers (1)

Lior Cohen
Lior Cohen

Reputation: 5745

TL;DR

Formally, No. Usually, Yes.

the setuptools is not part of the python vanilla codebase, hence not a vanilla modules.

python.org installers or mac homebrew will install it for you, but if someone compile the python by himself or install it on some linux distribution he may not get it and will need to install it by himself.

Upvotes: 6

Related Questions