Pypi UserWarning: Unknown distribution parameter: 'install_requires'

Does anyone encounter this warning when executing python setup.py install PyPI package?

install_requires determines what the package requires. Many PyPI packages have this option. How can this be an “unknown distribution option”?

+93
python pypi distutils
Nov 28 '11 at 12:13
source share
8 answers

python setup.py uses distutils, which does not support install_requires. setuptools does also distributes (its successor) and pip (which uses either) does. But you really have to use them. That is, call setuptools through the easy_install command or pip install .

Another way is to import the settings from setuptools into the setup.py file, but this is not standard and forces everyone who wants to use your package to install setuptools.

+79
May 21 '12 at 13:28
source share

This was the first result in my search on Google, but there was no answer. I found that updating setuptools solved this problem for me (and pip for a good measure)

 pip install --upgrade pip pip install --upgrade setuptools 

Hope this helps the next person find this link!

+20
Aug 22 '18 at 2:36
source share

Attention ! ATTENTION ! Imperfect answer ahead. To get a “final note” on packaging status in the Python universe, read this pretty detailed essay .

I just ran into this problem when trying to build / install ansible. The problem is that distutils really does not support install_requires. Setuptools should render monkey-patches harmless on the fly, but this is probably not because the latest version of setuptools since 2009 is 0.6c11, while distutils is the core of the Python project.

Thus, even after manual installation, setuptools-0.6c11-py2.7.egg launched by setup.py only picks distutils dist.py, not the one found from site-packages / setuptools /.

The setuptools documentation also indicates the use of ez_setup , not distutils.

However, setuptools itself is provided by distribute at the moment, and this taste of setup () supports install_requires.

+16
May 21 '12 at 9:44
source share

I am on a Mac with Python 2.7.11. I was creating extremely simple and understandable projects where my only requirement is that I can run python setup.py install , and for setup.py use the setup command, ideally from distutils. There are literally no other imports or code other than kwargs for setup() other than what I mark here.

I get an error when importing setup.py :

 from distutils.core import setup 

When I use this, I get warnings like

/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: unknown distribution parameter: 'entry_points' warnings.warn ( entry_points' msg)

If I change the import (and nothing more) to the following:

 from distutils.core import setup import setuptools # noqa 

Warnings go away.

Note that I do not use setuptools , just importing it changes the behavior so that it no longer generates warnings. For me, this is the reason for the truly incomprehensible difference when some of the projects that I use give these warnings, while others do not.

It is clear that some form of "monkey patch" is occurring, and it is affected by whether this import is performed. This is probably not the situation for anyone exploring this problem, but for the narrow environment that I work in, this is the answer I was looking for.




This is consistent with another (community) comment saying that distutils should install monkeypatch setuptools and that they have a problem installing Ansible. It seems that Ansible tried to allow the installation without having setuptools in the past, and then returned to this.

https://github.com/ansible/ansible/blob/devel/setup.py

There are many things in the air ... but if you are looking for a simple answer for a simple project, you probably should just import setuptools.

+11
Jun 06 '18 at 13:55
source share

This is a warning from distutils and is a sign that you do not have setuptools. Installing from http://pypi.python.org/pypi/setuptools will remove the warning.

+7
Nov 28 '11 at 15:38
source share
 sudo apt-get install python-dev # for python2.x installs sudo apt-get install python3-dev # for python3.x installs 

It will install any missing headers. He solved my problem

+4
Jul 17 '17 at 13:49 on
source share

As far as I can tell, this is a mistake in setuptools, where it does not remove specific setuptools parameters before calling the base class in the standard library: https://bitbucket.org/pypa/setuptools/issue/29/avoid-userwarnings-emitted-when-calling

If you have an unconditional import setuptools in your setup.py (as with the special setuptools options), the fact that the script does not work with ImportError indicates that setuptools is installed correctly.

You can disable the warning as follows:

 python -W ignore::UserWarning:distutils.dist setup.py <any-other-args> 

Only do this if you are using unconditional import, which will fail if setuptools is not installed :)

(I see the same behavior at the checkout from the setuptools repository after the merge, so I am sure that this is a setuptools error, not a system configuration problem. I expect that the distribution before the merge will have the same problem)

+2
Jul 02 '13 at 12:34 on
source share

Now I saw this in older tools using Python2.7, where an assembly (e.g. Dockerfile) installs an unsupported dependency, e.g. pytest. PyTest has discontinued support for Python 2.7, so you may need to specify version <release of a new package.

Or bite a bullet and convert this application to Python 3, if possible.

0
Jul 23 '19 at 16:23
source share



All Articles