[Biopython-dev] NumPy dialog when Biopython installed from automated programs

Connor McCoy cmccoy at fhcrc.org
Fri Oct 14 13:11:15 EDT 2011


Hi Brad, Eric, and Peter,

Sorry to jump in. Regarding the install_requires warnings:

If you're interested, you can include the distribute_setup.py file
from http://python-distribute.org/distribute_setup.py in BioPython,
and add a short conditional import:

try:
    from setuptools import setup, find_packages
except ImportError:
    import distribute_setup
    distribute_setup.use_setuptools()
    from setuptools import setup, find_packages

Which will download and install distribute if it isn't available in
the python installation; the remainder of the setup can assume
setuptools is available.  Sphinx
(https://bitbucket.org/birkenfeld/sphinx/src/f1f641602bb2/setup.py)
and some other projects use this.

Connor

On Fri, Oct 14, 2011 at 9:00 AM,
<biopython-dev-request at lists.open-bio.org> wrote:
> Send Biopython-dev mailing list submissions to
>        biopython-dev at lists.open-bio.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.open-bio.org/mailman/listinfo/biopython-dev
> or, via email, send a message with subject or body 'help' to
>        biopython-dev-request at lists.open-bio.org
>
> You can reach the person managing the list at
>        biopython-dev-owner at lists.open-bio.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Biopython-dev digest..."
>
>
> Today's Topics:
>
>   1. Re: NumPy dialog when Biopython installed from automated
>      programs (Eric Talevich)
>   2. Re: NumPy dialog when Biopython installed from    automated
>      programs (Brad Chapman)
>   3. Re: NumPy dialog when Biopython installed from automated
>      programs (Peter Cock)
>   4. Re: NumPy dialog when Biopython installed from automated
>      programs (Peter Cock)
>   5. Re: NumPy dialog when Biopython installed from    automated
>      programs (Brad Chapman)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 13 Oct 2011 14:00:22 -0400
> From: Eric Talevich <eric.talevich at gmail.com>
> Subject: Re: [Biopython-dev] NumPy dialog when Biopython installed
>        from automated programs
> To: Brad Chapman <chapmanb at 50mail.com>
> Cc: Biopython-Dev Mailing List <biopython-dev at biopython.org>
> Message-ID:
>        <CAMC681=h322OjGESjwj3n7n9CzvDWu=K2aY0mZinONO+PYk9Xg at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Thu, Oct 13, 2011 at 10:05 AM, Brad Chapman <chapmanb at 50mail.com> wrote:
>
>>
>> Hi all;
>> Biopython's setup.py currently has an interactive question/answer
>> session to remind users to optionally install NumPy if it's not
>> present. This is useful for by-hand installations, but problematic with
>> automated installers.
>>
>> One useful feature of setuptools is the 'install_requires' attribute in
>> setup.py. This allows your programs to define the requirements and have
>> them automatically installed from PyPi. It's a great way to include
>> useful libraries without having to fret excessively about users
>> installing dependencies.
>>
>> Unfortunately if you use install_requires with Biopython, and NumPy is
>> not installed, automated scripts will get stuck in the question/answer
>> dialog. To resolve this issue, I wrote a small patch that adds NumPy to
>> Biopython's install_requires and skips the Q/A only in cases where it is
>> installed via pip or easy_install:
>>
>>
>> https://github.com/chapmanb/biopython/commit/be53d850d721fc82af81bedcd9fb9034b0a2099b
>>
>> If someone is able to review this, it would be great to get it into
>> Biopython for the next release.
>>
>>
> Hi Brad,
>
> Looks cool to me, except the sys.argv parsing gets a little gritty
> (understandably):
>
> Line 115:
>
>    if dist_dir.find("egg-dist-tmp") >= 0:
>
> Could this be `if 'egg-dist-tmp' in dist_dir`?
>
>
> Line 118:
>
>    if sys.argv in [["-c", "develop", "--no-deps"],
>                    ["-c", "egg_info"]]:
>
> Does pip allow rearranging arguments? Would `--no-deps -c develop` also be
> valid?
> If so, should that be added as a third item in the list-of-args?
>
>
> -Eric
>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 14 Oct 2011 06:00:37 -0400
> From: Brad Chapman <chapmanb at 50mail.com>
> Subject: Re: [Biopython-dev] NumPy dialog when Biopython installed
>        from    automated programs
> To: Eric Talevich <eric.talevich at gmail.com>
> Cc: , Biopython-Dev Mailing List <biopython-dev at biopython.org>
> Message-ID: <87hb3b51ve.fsf at fastmail.fm>
> Content-Type: text/plain; charset=us-ascii
>
>
> Eric and Peter;
> Thanks much for taking a look at this patch.
>
>> Looks cool to me, except the sys.argv parsing gets a little gritty
>> (understandably):
>
> Absolutely. Unfortunately the python installation space is pretty
> messy. Neither pip not easy_install gives any formal declaration so you
> have to resort to these hacks to infer that they are doing the
> install. Luckily I don't think any of these options are something people
> would do directly from the command line.
>
>> Line 115:
>>
>>     if dist_dir.find("egg-dist-tmp") >= 0:
>>
>> Could this be `if 'egg-dist-tmp' in dist_dir`?
>
>> Line 118:
>>
>>     if sys.argv in [["-c", "develop", "--no-deps"],
>>                     ["-c", "egg_info"]]:
>>
>> Does pip allow rearranging arguments? Would `--no-deps -c develop` also be
>> valid?
>> If so, should that be added as a third item in the list-of-args?
>
> Awesome, thanks for the suggestions. I checked both of these in.
>
> Thanks again,
> Brad
>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 14 Oct 2011 11:53:42 +0100
> From: Peter Cock <p.j.a.cock at googlemail.com>
> Subject: Re: [Biopython-dev] NumPy dialog when Biopython installed
>        from automated programs
> To: Brad Chapman <chapmanb at 50mail.com>
> Cc: Biopython-Dev Mailing List <biopython-dev at biopython.org>
> Message-ID:
>        <CAKVJ-_6Spa7ynW+_DEq0HWj2zYtoy_pU4SMwtv3t6YaMM=E8yQ at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Fri, Oct 14, 2011 at 11:00 AM, Brad Chapman <chapmanb at 50mail.com> wrote:
>>
>> Awesome, thanks for the suggestions. I checked both of these in.
>>
>
> I'll test the branch today, and merge it to the trunk if it looks good
> on Python 2 / 3 / Jython / PyPy.
>
> Peter
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 14 Oct 2011 11:55:52 +0100
> From: Peter Cock <p.j.a.cock at googlemail.com>
> Subject: Re: [Biopython-dev] NumPy dialog when Biopython installed
>        from automated programs
> To: Brad Chapman <chapmanb at 50mail.com>
> Cc: Biopython-Dev Mailing List <biopython-dev at biopython.org>
> Message-ID:
>        <CAKVJ-_5XwM1QQ=+ZVvHwW=UyWHVFdNP0cz-LQ0UZU1JSsaAPMg at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On Fri, Oct 14, 2011 at 11:53 AM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>> On Fri, Oct 14, 2011 at 11:00 AM, Brad Chapman <chapmanb at 50mail.com> wrote:
>>>
>>> Awesome, thanks for the suggestions. I checked both of these in.
>>>
>>
>> I'll test the branch today, and merge it to the trunk if it looks good
>> on Python 2 / 3 / Jython / PyPy.
>>
>
> $ jython setup.py install
> /Users/pjcock/jython2.5.2/Lib/distutils/dist.py:263: UserWarning:
> Unknown distribution option: 'install_requires'
>  warnings.warn(msg)
> running install
> running build
> running build_py
> ...
>
>
> That's with Jython 2.5.2 under Mac OS X Snow Leopard. Same with pypy 1.6,
>
> $ pypy setup.py install
> /Users/pjcock/Downloads/Software/pypy-1.6/lib-python/modified-2.7/distutils/dist.py:267:
> UserWarning: Unknown distribution option: 'install_requires'
>  warnings.warn(msg)
> running install
> running build
> running build_py
> ...
>
> Can we avoid that warning?
>
> Peter
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 14 Oct 2011 08:26:06 -0400
> From: Brad Chapman <chapmanb at 50mail.com>
> Subject: Re: [Biopython-dev] NumPy dialog when Biopython installed
>        from    automated programs
> To: Peter Cock <p.j.a.cock at googlemail.com>
> Cc: , Biopython-Dev Mailing List <biopython-dev at biopython.org>
> Message-ID: <87ehyf4v4x.fsf at fastmail.fm>
> Content-Type: text/plain; charset=us-ascii
>
>
> Peter;
> Thanks for testing this and helping with the merge
>
>> $ jython setup.py install
>> /Users/pjcock/jython2.5.2/Lib/distutils/dist.py:263: UserWarning:
>> Unknown distribution option: 'install_requires'
>>   warnings.warn(msg)
> [...]
>> Can we avoid that warning?
>
> This is a warning from distutils, so you would also see this on regular
> ol' Python without setuptools installed. Likewise it should go away on
> jython or pypy if they have setuptools or distribute installed.
>
> Unfortunately I don't have a way around it since this is an argument to
> setup. Most modern installations should have setuptools and can take
> advantage of install_requires.
>
> If it's a problem we could use 'warnings' to ignore it.
>
> Brad
>
>
> ------------------------------
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev
>
>
> End of Biopython-dev Digest, Vol 105, Issue 12
> **********************************************
>



More information about the Biopython-dev mailing list