Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 343
Intrastellar Explorer Avatar asked Jun 27 '26 12:06

Intrastellar Explorer


1 Answers

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.

like image 162
Lior Cohen Avatar answered Jun 30 '26 02:06

Lior Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!