[Biopython-dev] numpy setup-time dependency workaround

Manuel Nuno Melo manuel.nuno.melo at gmail.com
Fri Oct 23 13:56:38 UTC 2015


Dear biopython devs,

I recently implemented in MDAnalysis a distutils/setuptools workaround (
https://github.com/MDAnalysis/mdanalysis/pull/499) to the numpy
dependency-at-setuptime problem, and I think biopython might benefit from
it.

The problem is that in setup.py distutils' setup() must be provided a list
of Extension objects, which in turn must contain the list of directories in
which to look for include files (namely, numpy's).

If numpy isn't installed the Extensions objects can't be instantiated. If
numpy is specified as a setup-time dependency it will get installed when
setup() is called, but the instantiation of the Extensions happens before
the call to setup(). We get a cyclic dependency in that we need to know the
path to the numpy install before calling the function that will install
numpy.

My solution was to subclass Extension to have a managed include_dirs
attribute which only probes for numpy at install-time. Since by then
setup() has had time to install numpy, all works fine.

I believe a similar workaround could work well for biopython (although it
might involve setting numpy as as hard requirement, or at least asking the
user beforehand whether to install it).

Of course, it would also benefit us at MDAnalysis since we could then
cleanly depend on biopython without worrying whether its install is
numpy-complete or not.

I'll be glad with helping with the implementation, if you think it's worthy.

Cheers,
Manel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython-dev/attachments/20151023/37356f64/attachment.html>


More information about the Biopython-dev mailing list