[Distutils] Telling distutils about requirements

Erik Bernoth erik.bernoth at gmail.com
Mon Feb 11 21:02:02 CET 2013


Sorry, I didn't know that this is not part of distutils. In my
understanding pip, setup.py and so on is all part of distutils. Should I
have asked my question on another mailing list? Then even more thanks for
the great help!


On Mon, Feb 11, 2013 at 8:55 PM, Daniel Holth <dholth at gmail.com> wrote:

> Not really. Install_requires is a setup tools/distribute feature.
> On Feb 11, 2013 2:52 PM, "Erik Bernoth" <erik.bernoth at gmail.com> wrote:
>
>> Yes, now it works! Thanks a lot! Last but not least, could you point me
>> in the correct direction to add a patch for the distutils documentation,
>> explaining this more clearly?
>>
>>
>> On Mon, Feb 11, 2013 at 8:34 PM, Daniel Holth <dholth at gmail.com> wrote:
>>
>>> Try install_requires = [ the list you have already without () ]
>>>
>>> Daniel
>>>
>>>
>>> On Mon, Feb 11, 2013 at 2:32 PM, Erik Bernoth <erik.bernoth at gmail.com>wrote:
>>>
>>>> I basically follow the tutorial in the distutils docs, which is a
>>>> little unclear to me in some points.
>>>>
>>>> If I do as you say it looks like this:
>>>> --------------------------------------------------------------
>>>>   [...]
>>>>     package_dir = { '' : src_path },
>>>>     requires = [
>>>>         'pylibssh2==1.0.1',
>>>>         'pyserial==2.5'
>>>>     ],provides = [
>>>>         '{} ({})'.format(project, version)
>>>>     ]
>>>>   [...]
>>>> --------------------------------------------------------------
>>>> And the result of ``$ python setup.py sdist`` is:
>>>>
>>>>     [...] # exception stack
>>>>     ValueError: expected parenthesized list: '==1.0.1'
>>>>
>>>> That also happens if I add spaces between project name and comparator.
>>>>
>>>>
>>>> On Mon, Feb 11, 2013 at 8:24 PM, Daniel Holth <dholth at gmail.com> wrote:
>>>>
>>>>> This is a common mistake. The parenthesis are a Metadata 1.2+ thing.
>>>>> Omit them for distutils.
>>>>>
>>>>>
>>>>> On Mon, Feb 11, 2013 at 2:22 PM, Erik Bernoth <erik.bernoth at gmail.com>wrote:
>>>>>
>>>>>>
>>>>>> On Mon, Feb 11, 2013 at 8:07 PM, Daniel Holth <dholth at gmail.com>wrote:
>>>>>>
>>>>>>> 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.
>>>>>>>
>>>>>>>
>>>>>> Hi Daniel,
>>>>>>
>>>>>> I also tried ``pip install monk_tf-v0.1.1.tar.gz``, with the same
>>>>>> result as using setup.py directly. He installs it but doesn't consider the
>>>>>> "requires" list.
>>>>>> From your mail I would interprete that distutils actually should
>>>>>> consider the required packages? Maybe I just wrote something incorrectly.
>>>>>> Does the following look like a correct statements of the requires
>>>>>> parameter?
>>>>>> --------------------------------------------------------------
>>>>>>   [...]
>>>>>>     package_dir = { '' : src_path },
>>>>>>     requires = [
>>>>>>         'pylibssh2 (==1.0.1)',
>>>>>>         'pyserial (==2.5)'
>>>>>>     ],provides = [
>>>>>>         '{} ({})'.format(project, version)
>>>>>>     ]
>>>>>>   [...]
>>>>>> --------------------------------------------------------------
>>>>>>
>>>>>> Cheers
>>>>>> Erik
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130211/42ae1367/attachment-0001.html>


More information about the Distutils-SIG mailing list