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
973
votes
9 answers

Why use pip over easy_install?

A tweet reads: Don't use easy_install, unless you like stabbing yourself in the face. Use pip. Why use pip over easy_install? Doesn't the fault lie with PyPI and package authors mostly? If an author uploads crap source tarball (eg: missing…
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
716
votes
13 answers

How do I remove packages installed with Python's easy_install?

Python's easy_install makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages. What is the best way of…
ire_and_curses
  • 68,372
  • 23
  • 116
  • 141
676
votes
23 answers

How to install pip with Python 3?

I want to install pip. It should support Python 3, but it requires setuptools, which is available only for Python 2. How can I install pip with Python 3?
deamon
  • 89,107
  • 111
  • 320
  • 448
639
votes
5 answers

Differences between distribute, distutils, setuptools and distutils2?

The Situation I’m trying to port an open-source library to Python 3. (SymPy, if anyone is wondering.) So, I need to run 2to3 automatically when building for Python 3. To do that, I need to use distribute. Therefore, I need to port the current…
VPeric
  • 7,391
  • 6
  • 21
  • 17
568
votes
38 answers

No module named pkg_resources

I'm deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt: Traceback (most recent call last): File "/var/www/mydir/virtualenvs/dev/bin/pip", line 5, in from pkg_resources import…
igniteflow
  • 8,404
  • 10
  • 38
  • 46
445
votes
3 answers

Python setup.py develop vs install

Two options in setup.py develop and install are confusing me. According to this site, using develop creates a special link to site-packages directory. People have suggested that I use python setup.py install for a fresh installation and python…
Netro
  • 7,119
  • 6
  • 40
  • 58
438
votes
19 answers

Reference requirements.txt for the install_requires kwarg in setuptools setup.py file

I have a requirements.txt file that I'm using with Travis-CI. It seems silly to duplicate the requirements in both requirements.txt and setup.py, so I was hoping to pass a file handle to the install_requires kwarg in setuptools.setup. Is this…
Louis Thibault
  • 20,240
  • 25
  • 83
  • 152
384
votes
25 answers

Standard way to embed version into Python package?

Is there a standard way to associate version string with a Python package in such way that I could do the following? import foo print(foo.version) I would imagine there's some way to retrieve that data without any extra hardcoding, since…
Dimitri Tcaciuc
  • 5,053
  • 5
  • 20
  • 22
271
votes
3 answers

Explain Python entry points?

I've read the documentation on egg entry points in Pylons and on the Peak pages, and I still don't really understand. Could someone explain them to me?
Brad Wright
  • 5,602
  • 6
  • 29
  • 30
250
votes
15 answers

What's the proper way to install pip, virtualenv, and distribute for Python?

Short Question What is the proper way to install pip, virtualenv, and distribute? Background In my answer to SO question 4314376, I recommended using ez_setup so that you could then install pip and virtualenv as follows: curl -O…
Matthew Rankin
  • 457,139
  • 39
  • 126
  • 163
226
votes
4 answers

"pip install --editable ./" vs "python setup.py develop"

Is there any significant difference between pip install -e /path/to/mypackage and the setuptools variant? python /path/to/mypackage/setup.py develop
PeterE
  • 5,715
  • 5
  • 29
  • 51
203
votes
21 answers

How can I get the version defined in setup.py (setuptools) in my package?

How could I get the version defined in setup.py from my package (for --version, or other purposes)?
elmarco
  • 31,633
  • 21
  • 64
  • 68
201
votes
4 answers

setuptools vs. distutils: why is distutils still a thing?

Python has a confusing history of tools that can be used to package and describe projects: these include distutils in the Standard Library, distribute, distutils2, and setuptools (and maybe more). It appears that distribute and distutils2 were…
cel
  • 30,017
  • 18
  • 97
  • 117
195
votes
8 answers

Why can I not create a wheel in python?

Here are the commands I am running: $ python setup.py bdist_wheel usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help error: invalid…
vitiral
  • 8,446
  • 8
  • 29
  • 43
191
votes
14 answers

How to include package data with setuptools/distutils?

When using setuptools, I can not get the installer to pull in any package_data files. Everything I've read says that the following is the correct way to do it. Can someone please advise? setup( name='myapp', packages=find_packages(), …
cmcginty
  • 113,384
  • 42
  • 163
  • 163
1
2 3
99 100