Skip to main content

Questions tagged [setuptools]

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

setuptools
Filter by
Sorted by
Tagged with
977 votes
9 answers
243k views

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 ...
Sridhar Ratnakumar's user avatar
717 votes
13 answers
553k views

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 ...
ire_and_curses's user avatar
699 votes
23 answers
2.0m views

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's user avatar
  • 91.3k
642 votes
5 answers
100k views

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 ...
VPeric's user avatar
  • 7,441
636 votes
39 answers
934k views

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", ...
igniteflow's user avatar
  • 9,112
453 votes
3 answers
211k views

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 ...
Netro's user avatar
  • 7,269
448 votes
20 answers
247k views

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 ...
Louis Thibault's user avatar
408 votes
25 answers
306k views

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 ...
Dimitri Tcaciuc's user avatar
281 votes
3 answers
180k views

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's user avatar
  • 5,742
249 votes
15 answers
159k views

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 ...
Matthew Rankin's user avatar
227 votes
4 answers
97k views

"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's user avatar
  • 5,775
209 votes
21 answers
152k views

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's user avatar
  • 32.6k
205 votes
4 answers
63k views

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 ...
cel's user avatar
  • 31k
195 votes
8 answers
132k views

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-...
vitiral's user avatar
  • 8,910
195 votes
14 answers
144k views

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( ...
cmcginty's user avatar
  • 116k
177 votes
7 answers
97k views

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( ...
Ankur Agarwal's user avatar
163 votes
4 answers
91k views

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 ...
andrei's user avatar
  • 2,073
158 votes
2 answers
93k views

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 ...
Neil Walker's user avatar
  • 6,688
133 votes
11 answers
166k views

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 ...
quanticle's user avatar
  • 4,972
133 votes
7 answers
65k views

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 ...
Chris Simpkins's user avatar
117 votes
16 answers
92k views

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 ...
brianmearns's user avatar
  • 9,817
117 votes
6 answers
52k views

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 <package> results in an error No module named <...
André Betz's user avatar
  • 1,451
111 votes
4 answers
46k views

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 ...
Joe Holloway's user avatar
  • 28.7k
109 votes
4 answers
62k views

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 ...
phant0m's user avatar
  • 16.8k
108 votes
10 answers
50k views

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', ...,...
Eric P's user avatar
  • 4,637
105 votes
7 answers
118k views

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 ...
vamsi's user avatar
  • 1,329
104 votes
5 answers
62k views

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 ...
a_guest's user avatar
  • 35.5k
103 votes
5 answers
91k views

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, ...
Ram Rachum's user avatar
102 votes
5 answers
70k views

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", ...
joaoricardo000's user avatar
101 votes
3 answers
28k views

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 ...
copyninja's user avatar
  • 1,407
99 votes
3 answers
68k views

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 ...
Harish R's user avatar
  • 1,199
96 votes
3 answers
38k views

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's user avatar
  • 1,101
92 votes
16 answers
126k views

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-...
coffee-grinder's user avatar
91 votes
1 answer
34k views

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 ...
nfarrar's user avatar
  • 2,331
88 votes
1 answer
74k views

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-...
Jeremy Cantrell's user avatar
86 votes
9 answers
28k views

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 ...
Jace Browning's user avatar
85 votes
14 answers
91k views

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 ...
corvuscorax's user avatar
  • 5,910
83 votes
3 answers
34k views

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 >=...
orome's user avatar
  • 47.6k
81 votes
6 answers
52k views

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 ...
syabro's user avatar
  • 1,867
81 votes
4 answers
33k views

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 $ ...
gman's user avatar
  • 105k
79 votes
1 answer
58k views

How to write a minimally working pyproject.toml file that can install packages?

Pip supports the pyproject.toml file but so far all practical usage of the new schema requires a 3rd party tool that auto-generates these files (e.g., poetry and pip). Unlike setup.py which is already ...
Keto's user avatar
  • 1,800
76 votes
2 answers
53k views

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, ...
Santhosh's user avatar
  • 935
76 votes
3 answers
42k views

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 ...
Wayne Walker's user avatar
  • 2,436
74 votes
12 answers
53k views

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 ...
orome's user avatar
  • 47.6k
74 votes
2 answers
37k views

How to reference a requirements.txt in the pyproject.toml of a setuptools project?

I'm trying to migrate a setuptools-based project from the legacy setup.py towards modern pyproject.toml configuration. At the same time I want to keep well established workflows based on pip-compile, ...
bluenote10's user avatar
  • 25.6k
74 votes
2 answers
28k views

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 ...
saffsd's user avatar
  • 24.1k
73 votes
2 answers
27k views

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 ...
jldupont's user avatar
  • 95.9k
71 votes
4 answers
60k views

Managing resources in a Python project

I have a Python project in which I am using many non-code files. Currently these are all images, but I might use other kinds of files in the future. What would be a good scheme for storing and ...
Ram Rachum's user avatar
70 votes
5 answers
30k views

Why does "python setup.py sdist" create unwanted "PROJECT-egg.info" in project root directory?

When I run python setup.py sdist it creates an sdist in my ./dist directory. This includes a "PROJECT-egg.info" file in the zip inside my "dist" folder, which I don't use, but it doesn't hurt me, ...
Jonathan Hartley's user avatar
69 votes
5 answers
30k views

How to specify version ranges in install_requires (setuptools, distribute)

I want to make a package to depend the particular version range e.g. >= 0.5.0, < 0.7.0. Is it possible in install_requires option, and if so how should it be?
minhee's user avatar
  • 5,788

1
2 3 4 5
71