[Distutils] Telling distutils about requirements

Daniel Holth dholth at gmail.com
Mon Feb 11 20:07:19 CET 2013

On Mon, Feb 11, 2013 at 1:10 PM, Erik Bernoth <erik.bernoth at gmail.com>wrote:

> Hi everybody,
> I think I pretty much read all of the http://docs.python.org/2/distutils/and started to create a pypi repository for my project (
> http://pypi.python.org/pypi/monk_tf). Now there are some things that are
> not so clear from the documentation, with the most important being
> requirement handling.
> I have the same requirements written down in two ways:
>  a) a requirements.txt file, which can be called with pip install -r
> requirements.txt. Yet I don't see any user downloading a requirements.txt
> file from somewhere, then installing it and only then afterwards getting
> started with actually installing the package they want to install. Who
> would do that?
>  b) requires attribute in the setup function call in setup.py. For some
> reason pip completely seems to ignore it. I tested the following way (come
> along with the code from https://github.com/DFE/MONK, if you like):
>     $ cd MONK
>     $ python setup.py sdist
>     $ cd dist
>     $ tar xfvz monk_tf-v0.1.1.tar.gz
>     $ cd monk_tf-v0.1.1
>     $ python setup.py install
>     running install
>     running build
>     running build_py
>     running install_lib
>     running install_egg_info
>     Writing /usr/local/lib/python2.7/dist-packages/monk_tf-v0.1.1.egg-info
>     $python
>     >> import monk_tf
>     (Exception, because a required package can't be found)
> So this also didn't seem to install any of the required packages.
> I'd really like to know, what I am doing wrong here. Anybody ideas or
> suggestions? Is there another way to tell distutils about the packages that
> should be installed before my package is installed?
> Cheers
> Erik

Generally requires.txt is for specific versions of dependencies and the
setup.py list is more permissive.

Try using pip to install your sdist instead of running setup.py directly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130211/b572b1cb/attachment.html>

More information about the Distutils-SIG mailing list