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
170
votes
7 answers

How to write setup.py to include a Git repository as a dependency

I am trying to write setup.py for my package. My package needs to specify a dependency on another Git repository. This is what I have so far: from setuptools import setup, find_packages setup( name='abc', packages=find_packages(), …
Ankur Agarwal
  • 23,692
  • 41
  • 137
  • 208
161
votes
4 answers

How can I make setuptools install a package that's not on PyPI?

I've just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that's on PyPI is an old one. The Github source is setuptools-compatible, i.e. has…
andrei
  • 2,053
  • 3
  • 17
  • 16
156
votes
2 answers

Do python projects need a MANIFEST.in, and what should be in it?

The "Python Distribute" guide tells me to include doc/txt files and .py files are excluded in MANIFEST.in file The sourcedist documentation tells me only sdist uses MANIFEST.in and only includes file you specify and to include .py files. It also…
Neil Walker
  • 6,400
  • 14
  • 57
  • 86
133
votes
11 answers

Installing SetupTools on 64-bit Windows

I'm running Python 2.7 on Windows 7 64-bit, and when I run the installer for setuptools it tells me that Python 2.7 is not installed. The specific error message is: `Python Version 2.7 required which was not found in the registry` My installed…
quanticle
  • 4,872
  • 6
  • 32
  • 42
132
votes
7 answers

Post-install script with Python setuptools

Is it possible to specify a post-install Python script file as part of the setuptools setup.py file so that a user can run the command: python setup.py install on a local project file archive, or pip install for a PyPI project and the…
Chris Simpkins
  • 1,534
  • 2
  • 11
  • 13
111
votes
4 answers

When to use pip requirements file versus install_requires in setup.py?

I'm using pip with virtualenv to package and install some Python libraries. I'd imagine what I'm doing is a pretty common scenario. I'm the maintainer on several libraries for which I can specify the dependencies explicitly. A few of my…
Joe Holloway
  • 28,320
  • 15
  • 82
  • 92
111
votes
15 answers

Why is pip installing an old version of my package?

I've just uploaded a new version of my package to PyPi (1.2.1.0-r4): I can download the egg file and install it with easy_install, and the version checks out correctly. But when I try to install using pip, it installs version 1.1.0.0 instead. Even…
brianmearns
  • 9,581
  • 10
  • 52
  • 79
109
votes
4 answers

setuptools: package data folder location

I use setuptools to distribute my python package. Now I need to distribute additional datafiles. From what I've gathered fromt the setuptools documentation, I need to have my data files inside the package directory. However, I would rather have my…
phant0m
  • 16,595
  • 5
  • 50
  • 82
106
votes
10 answers

Python setuptools: How can I list a private repository under install_requires?

I am creating a setup.py file for a project which depends on private GitHub repositories. The relevant parts of the file look like this: from setuptools import setup setup(name='my_project', ..., install_requires=[ …
Eric P
  • 4,587
  • 6
  • 24
  • 19
103
votes
5 answers

pip install . creates only the dist-info not the package

I am trying to make a python package which I want to install using pip install . locally. The package name is listed in pip freeze but import results in an error No module named . Also the site-packages folder does only contain a…
André Betz
  • 1,291
  • 2
  • 10
  • 9
102
votes
5 answers

How do I install an old version of Django on virtualenv?

I want to install some specific version of a package (in this case Django) inside the virtual environment. I can't figure it out. I'm on Windows XP, and I created the virtual environment successfully, and I'm able to run it, but how am I supposed to…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
101
votes
5 answers

How include static files to setuptools - python package

I want to include the ./static/data.txt to setuptools, here is my code: # setup.py import os,glob from setuptools import setup,find_packages setup( name = "PotatoProject", version = "0.1.1", author = "Master Splinter", author_email…
joaoricardo000
  • 4,764
  • 4
  • 25
  • 36
99
votes
3 answers

Removing python module installed in develop mode

I was trying the python packaging using setuptools and to test I installed the module in develop mode. i.e python setup.py develop This has added my modules directory to sys.path. Now I want to remove the module. Is there any way to do this?
copyninja
  • 1,387
  • 2
  • 10
  • 19
95
votes
6 answers

Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.)

version pip 21.2.4 python 3.6 The command: pip install -r requirements.txt The content of my requirements.txt: mongoengine==0.19.1 numpy==1.16.2 pylint pandas==1.1.5 fawkes The command is failing with this error ERROR: Command errored out with…
vamsi
  • 1,219
  • 1
  • 9
  • 15
95
votes
3 answers

What is the difference between `extras_require()` and `install_requires()` in setup.py?

I am trying to understand the difference between extras_require() and install_requires() in setup.py but haven't been able to get it. Both are used for installing Python dependencies, but what's the difference between them?
Harish R
  • 1,159
  • 2
  • 8
  • 10