Skip to main content

Questions tagged [setup.py]

setup.py is a Python script required by libraries packaged and distributed with Distutils.

Filter by
Sorted by
Tagged with
1613 votes
10 answers
1.2m views

What is setup.py?

What is setup.py and how can it be configured or used?
Software Enthusiastic's user avatar
944 votes
18 answers
543k views

python setup.py uninstall

I have installed a python package with python setup.py install. How do I uninstall it?
flybywire's user avatar
  • 269k
923 votes
22 answers
835k views

Why is python setup.py saying invalid command 'bdist_wheel' on Travis CI?

My Python package has a setup.py which builds fine locally on Ubuntu Trusty and on a fresh Vagrant Ubuntu Trusty VM when I provision it like this: sudo apt-get install python python-dev --force-yes --...
nokome's user avatar
  • 10.2k
878 votes
43 answers
962k views

error: Unable to find vcvarsall.bat

I tried to install the Python package dulwich: pip install dulwich But I get a cryptic error message: error: Unable to find vcvarsall.bat The same happens if I try installing the package manually: ...
okada's user avatar
  • 8,789
447 votes
24 answers
1.0m views

Python 3: ImportError "No Module named Setuptools"

I'm having troubles with installing packages in Python 3. I have always installed packages with setup.py install. But now, when I try to install the ansicolors package I get: importerror "No ...
user1994934's user avatar
  • 4,473
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
250 votes
5 answers
120k views

requirements.txt vs setup.py

I started working with Python. I've added requirements.txt and setup.py to my project. But, I am still confused about the purpose of both files. I have read that setup.py is designed for ...
lucy's user avatar
  • 4,366
173 votes
6 answers
438k views

How do I install Python packages in Google's Colab?

In a project, I have e.g. two different packages, How can I use the setup.py to install these two packages in the Google's Colab, so that I can import the packages?
Lin Jianjie's user avatar
  • 1,730
156 votes
3 answers
113k views

Difference between 'python setup.py install' and 'pip install'

I have an external package I want to install into my python virtualenv from a tar file. What is the best way to install the package? I've discovered 2 ways that can do it: Extract the tar file, then ...
user2125465's user avatar
  • 1,615
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
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
114 votes
7 answers
290k views

No module named setuptools

I want to install setup file of twilio. When I install it through given command it is given me an error: No module named setuptools. Could you please let me know what should I do? I am using ...
user2885082's user avatar
  • 1,149
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
108 votes
4 answers
44k views

Difference between entry_points/console_scripts and scripts in setup.py?

There are basically two ways to install Python console scripts to my path by setup.py: setup( ... entry_points = { 'console_scripts': [ 'foo = package.module:func', ...
Honza Javorek's user avatar
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
89 votes
8 answers
57k views

distutils: How to pass a user defined parameter to setup.py?

How can I pass a user-defined parameter both from the command line and setup.cfg configuration file to distutils' setup.py script? I want to write a setup.py script, which accepts my package specific ...
user avatar
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
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
65 votes
12 answers
44k views

How to add package data recursively in Python setup.py?

I have a new library that has to include a lot of subfolders of small datafiles, and I'm trying to add them as package data. Imagine I have my library as so: library - foo.py - bar.py data ...
Dashing Adam Hughes's user avatar
64 votes
8 answers
63k views

Using an extra python package index url with setup.py

Is there a way to use an extra Python package index (ala pip --extra-index-url pypi.example.org mypackage) with setup.py so that running python setup.py install can find the packages hosted on pypi....
Jeremy's user avatar
  • 2,916
57 votes
2 answers
51k views

Specifying command line scripts in pyproject.toml

I'm trying to add a pyproject.toml to a project that's been using setup.py in order to enable support by pipx. I'd like to specify the command line scripts the project includes in pyproject.toml, but ...
polm23's user avatar
  • 15.3k
50 votes
9 answers
46k views

Is it possible to include subdirectories using dist utils (setup.py) as part of package data?

Basically my python package is setup like: module \_examples \_folder1 \_file1.py \_file2.py \_folder2 \_file1.py \_file2.py Basically I want to just use: package_data = { ...
xamox's user avatar
  • 2,739
50 votes
6 answers
45k views

How to include and install local dependencies in setup.py in Python?

I am creating a setup.py to distribute my application. This application has a number of dependencies which can be installed via pip, it also has some custom dependencies which can not be installed ...
tastyminerals's user avatar
49 votes
5 answers
16k views

Python Packaging: Data files are put properly in tar.gz file but are not installed to virtual environment

I can't properly install the project package_fiddler to my virtual environment. I have figured out that MANIFEST.in is responsible for putting the non-.py files in Package_fiddler-0.0.0.tar.gz ...
Bentley4's user avatar
  • 10.8k
48 votes
4 answers
27k views

make distutils in Python automatically find packages

When describing a python package in setup.py in distutils in Python, is there a way to make it so automatically get every directory that has a __init__.py in it and include that as a subpackage? ie ...
user avatar
48 votes
7 answers
61k views

How can you bundle all your python code into a single zip file?

It would be convenient when distributing applications to combine all of the eggs into a single zip file so that all you need to distribute is a single zip file and an executable (some custom binary ...
Doug's user avatar
  • 34.4k
48 votes
1 answer
59k views

Install python packages to correct anaconda environment

I've setup anaconda and created a python 3.3 environment. Now I wanted to install some package (dataset). The install instructions ask to clone the git repo and run python setup.py install but now ...
Andreas Dolk's user avatar
45 votes
1 answer
21k views

Specifying optional dependencies in pypi python setup.py

How do I specify optional dependencies in python's setup.py ? Here's my stab at specifying an optional dependency for an open source library of mine but it doesn't seem to do much. https://github....
Calvin Cheng's user avatar
  • 36.2k
43 votes
2 answers
30k views

How can I include package_data without a MANIFEST.in file?

How can I include package_data for sdist without a MANIFEST.in file? My setup.py looks like this: import setuptools setuptools.setup( name='foo', version='2015.3', license='commercial', ...
guettli's user avatar
  • 27.7k
43 votes
2 answers
15k views

Setting up setup.py for packaging of a single .py file and a single data file without needing to create any folders

Project tree: $. ├── happy_birthday-art.txt ├── happy_birthday.py ├── MANIFEST.in ├── README.rst └── setup.py setup.py from setuptools import setup setup( name='Happy_birthday', py_modules=...
Bentley4's user avatar
  • 10.8k
41 votes
2 answers
74k views

Python setup.py: How to get find_packages() to identify packages in subdirectories

I'm trying to create a setup.py file where find_packages() recursively finds packages. In this example, foo, bar, and baz are all modules that I want to be installed and available on the python path. ...
Joe J's user avatar
  • 10.6k
40 votes
1 answer
16k views

What is the graft command in Python's MANIFEST.in file?

I found a Python project with a MANIFEST.in file. I can guess at the meaning of much of it, but I am unclear on the meaning of the line: graft tools
Michael Felt's user avatar
37 votes
3 answers
11k views

setup.py: restrict the allowable version of the python interpreter

I have a Python library. Unfortunately I have not updated it to work with Python 3 yet. In its setup.py, I added install_requires=['python<3'], My intent was to not allow this package to be ...
gfxmonk's user avatar
  • 8,684
35 votes
2 answers
14k views

Using setup.py to install python project as a systemd service

I have a python project and I want to be able to install it using something like python setup.py install so that the installation automatically creates a systemd service. I'm having some trouble, ...
newlog's user avatar
  • 1,030
34 votes
1 answer
18k views

How to include docs directory in python distribution

I have a python project with the following structure: Clustering (project name) clustering (package) clustering.py and other modules tests (sub-package) test_clustering.py and ...
Abhi's user avatar
  • 1,267
34 votes
3 answers
15k views

Is there a simple way to convert setup.py to pyproject.toml

We have multiple python projects, and are considering converting them to use pyproject.toml instead of setup.py. Is there a simple way to automate this?
user17304108's user avatar
34 votes
2 answers
15k views

Is there complete documentation for `setup.cfg`?

The Python Packaging Tutorial recommends that "Static metadata (setup.cfg) should be preferred. Dynamic metadata (setup.py) should be used only as an escape hatch when absolutely necessary. setup....
intuited's user avatar
  • 23.8k
33 votes
11 answers
75k views

Why can't I find ansible when I install it using setup.py?

Because I had some trouble with Ansible (I'm on mac) which seemed to be fixed in the latest dev version today I uninstalled ansible through pip (sudo pip uninstall ansible) and reinstalled the latest ...
kramer65's user avatar
  • 52.7k
32 votes
2 answers
14k views

What does the `platforms` argument to `setup()` in `setup.py` do?

Looking through several projects recently, I noticed some of them use platforms argument to setup() in setup.py, though with only one value of any, i.e. #setup.py file in project's package folder ......
Nikita's user avatar
  • 6,291
31 votes
1 answer
20k views

Using python_requires to require Python 2.7 or 3.2+

How do I use python_requires classifier in setup.py to require Python 2.7.* or 3.2+? I have tried many configurations, including this one: ~=2.7,==3,!=3.0,!=3.1,<4 but none have worked
wolfy1339's user avatar
  • 784
31 votes
6 answers
16k views

pip install PyQt IOError

I'm trying to install PyQt package with pip, but I get this error: ~$ pip install PyQt Downloading/unpacking PyQt Downloading PyQt-x11-gpl-4.8.3.tar.gz (9.8Mb): 9.8Mb downloaded Running setup.py ...
J91321's user avatar
  • 437
31 votes
1 answer
14k views

Any python function to get "data_files" root directory?

This should be a very common question for developers who used "setup.py" to build installation packages and it should be asked before but I couldn't find the proper answer anywhere. In setup.py from ...
Jessada Thutkawkorapin's user avatar
30 votes
3 answers
12k views

python setup.py sdist only including .py source from top level module

I have a setup.py: from setuptools import setup setup( ... packages=['mypackage'], test_suite='mypackage.tests', ... ) python setup.py sdist creates a file that includes ...
user1561108's user avatar
  • 2,707
30 votes
5 answers
13k views

Force compiler when running python setup.py install

Is there a way to explicitly force the compiler for building Cython extensions when running python setup.py install? Where setup.py is of the form: import os.path import numpy as np from setuptools ...
rth's user avatar
  • 11.1k
30 votes
1 answer
3k views

should pytest et al. go in tests_require[] or extras_require{testing[]}?

I am writing a python program which uses py.test for testing and now one test also depends on numpy. Where in my setup.py should I add those dependencies? Currently the relevant part of my setup.py ...
Michael Große's user avatar
29 votes
5 answers
22k views

How to force a python wheel to be platform specific when building it?

I am working on a python2 package in which the setup.py contains some custom install commands. These commands actually build some Rust code and output some .dylib files that are moved into the python ...
Adrien Ball's user avatar
28 votes
2 answers
24k views

Cython setup.py for several .pyx

I would like to cythonize faster. Code for one .pyx is from distutils.core import setup from Cython.Build import cythonize setup( ext_modules = cythonize("MyFile.pyx") ) What if i want to ...
kiriloff's user avatar
  • 26.1k
28 votes
2 answers
2k views

how to set bug tracker url in setup.py script

I have just discovered the pypi web UI have a field 'Bug tracker URL' in edit of egg metadata. This field exists so I guess it is supported in setup.py but I can't find anything about this using ...
toutpt's user avatar
  • 5,190
28 votes
1 answer
26k views

setup.py & pip: override one of the dependency's sub-dependency from requirements.txt

I'm currently working on a package and in my requirements.txt, I have a dependency: wikipedia. Now, wikipedia 1.3 uses requests-2.2.1 while my package uses version 2.3.0. Also, as one would expect, ...
arcolife's user avatar
  • 416
27 votes
3 answers
8k views

How to use setup.py to install dependencies only?

I am not interested in installing my package itself but I am interested installing all the dependencies used by my package. Is there a way to do this using setup.py? It seems setup.py installs my ...
Cory's user avatar
  • 15.4k

1
2 3 4 5
36