Questions tagged [setuptools]

setuptools is a set of enhancements to Python's distutils which simplify building, distribution and installation of Python packages.

setuptools is a (largely) drop-in replacement for distutils first published in 2004. Its most notable addition over the unmodified distutils tools was the ability to declare dependencies on other packages. It is currently recommended as a more regularly updated alternative to distutils that offers consistent support for more recent packaging standards across a wide range of Python versions.

The recommended pip installer runs all setup.py scripts with setuptools, even if the script itself only imports distutils.
This text is Copyright © 2001-2021 Python Software Foundation; All Rights Reserved.


Tag usage

  • Questions about setuptools-specific features should be tagged .
  • If a question is only about functionality common to both distutils and setuptools, the tag can be used in advance.
  • If it's unclear that the question author is using setuptools, the tag should be used instead.

Other related tags:

Modern alternatives to setuptools

Resources

3420 questions
93
votes
3 answers

What's the difference between setup.py and setup.cfg in python projects

Need to know what's the difference between setup.py and setup.cfg. Both are used prominently in openstack projects
Bharadwaj
  • 1,071
  • 2
  • 8
  • 8
91
votes
16 answers

What is the official "preferred" way to install pip and virtualenv systemwide?

Is it this, which people seem to recommend most often: $ sudo apt-get install python-setuptools $ sudo easy_install pip $ sudo pip install virtualenv Or this, which I got from http://www.pip-installer.org/en/latest/installing.html: $ curl -O…
coffee-grinder
  • 26,940
  • 19
  • 56
  • 82
89
votes
1 answer

Setuptools "development" Requirements

TL;DR: Is there a way to hook setuptool's 'develop' to install a set of development requirements when running python setup.py develop? I'm building my first python package using setuptools. I'm specifying the requirements as: requirements = [ …
nfarrar
  • 2,291
  • 4
  • 25
  • 33
86
votes
5 answers

How to install a package using pip in editable mode with pyproject.toml?

When a project is specified only via pyproject.toml (i.e. no setup.{py,cfg} files), how can it be installed in editable mode via pip (i.e. python -m pip install -e .)? I tried both setuptools and poetry for the build system, but neither…
a_guest
  • 34,165
  • 12
  • 64
  • 118
86
votes
1 answer

Python packages and egg-info directories

Can someone explain how egg-info directories are tied to their respective modules? For example, I have the following: /usr/local/lib/python2.5/site-packages/quodlibet/ /usr/local/lib/python2.5/site-packages/quodlibet-2.0.egg-info/ I'm assuming the…
Jeremy Cantrell
  • 26,392
  • 13
  • 55
  • 78
85
votes
14 answers

How do I set up Setuptools for Python 2.6 on Windows?

Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. Does anyone…
corvuscorax
  • 5,850
  • 3
  • 30
  • 31
84
votes
9 answers

What is the correct way to share package version with setup.py and the package?

With distutils, setuptools, etc. a package version is specified in setup.py: # file: setup.py ... setup( name='foobar', version='1.0.0', # other attributes ) I would like to be able to access the same version number from within the package: >>>…
Jace Browning
  • 11,699
  • 10
  • 66
  • 90
83
votes
3 answers

Latest 'pip' fails with "requires setuptools >= 0.8 for dist-info"

Using the recent (1.5) version of pip, I get an error when attempting to update several packages. For example, sudo pip install -U pytz results in failure with: Wheel installs require setuptools >= 0.8 for dist-info support. pip's wheel support…
orome
  • 45,163
  • 57
  • 202
  • 418
81
votes
4 answers

Upgrading setuptools on OSX El Capitan

I'm trying to upgrade setuptools. Well actually I'm trying to upgrade ansible but it's trying to upgrade setuptools and failing. Trying to do it myself also fails. Even trying to uninstall it fails $ sudo -H pip install --upgrade…
gman
  • 100,619
  • 31
  • 269
  • 393
81
votes
6 answers

pip ignores dependency_links in setup.py

I have dependency_links in my setup.py: ... dependency_links = ['http://github.com/robot-republic/python-s3/tarball/master.tar.gz#egg=python-s3'], ... But it doesn't work. However install_requires works fine. Maybe there are another method to set…
syabro
  • 1,857
  • 2
  • 15
  • 30
74
votes
12 answers

Symbol not found: __PyCodecInfo_GetIncrementalDecoder

Since updating from Homebrew Python 2.7.11 (from 2.7.10) I'm suddenly unable to test register my package on PyPi from the PyCharm IDE console. Running (as an "External Tool") python -B setup.py register -r pypitest I now get Traceback (most recent…
orome
  • 45,163
  • 57
  • 202
  • 418
74
votes
2 answers

What is the advantage of setting zip_safe to True when packaging a Python project?

The setuptools documentation only states: For maximum performance, Python packages are best installed as zip files. Not all packages, however, are capable of running in compressed form, because they may expect to be able to access either source…
saffsd
  • 23,742
  • 18
  • 63
  • 67
72
votes
3 answers

How may I override the compiler (GCC) flags that setup.py uses by default?

I understand that setup.py uses the same CFLAGS that were used to build Python. I have a single C extension of ours that is segfaulting. I need to build it without -O2 because -O2 is optimizing out some values and code so that the core files are not…
Wayne Walker
  • 2,316
  • 3
  • 23
  • 25
72
votes
2 answers

stopping setup.py from installing as egg

How do I stop setup.py from installing a package as an egg? Or even better, how do I easy_install from installing a package as an egg? sudo python setup.py install The reason being that PyDev is rather picky about packages in egg format... The…
jldupont
  • 93,734
  • 56
  • 203
  • 318
71
votes
2 answers

Enforcing python version in setup.py

Currently, we are setting\installing up some packages on system by mentioning their version and dependencies in setup.py under install_requires attribute. Our system requires Python 2.7. Sometimes, users are having multiple versions of Python on…
Santhosh
  • 885
  • 1
  • 9
  • 15