How to require and install a package using python 3.x distutils?

I have a program that uses dateutilfrom a package index. I would like setup.py to check its presence and try to get it using easy_installif it is not there.

The documentation fordistutils , apparently, indicates that this can be done using the keyword requiresin setup(), but when I try, it installs the system dateutilwithout warning or installing the necessary package.

The only thing I could find on google was in this blog post about the same issue , which also had no response.

Am I using it distutilsincorrectly? Do I need to subclass distutils.command.installand do the check / install myself?

+5
source share
2 answers

Automatic dependency loading is a feature introduced by setuptools , which is a third-party addition to distutils, in particular, the added install_requiresargument. See the setuptools documentation for more information .

Another option is to use a requirements.txtfile with pip instead of using it easy_installas a package installer. pipNow has become a recommended installer; see the Python Packaging User Guide for more information.

[2015-01]: distribute fork setuptools. distribute setuptools. distribute . setuptools pip Python 3.

+4

install_requires distutils , sdist, : python setup.py sdist

0

All Articles