[SciPy-User] SciPy pip and PyPi

Francesc Alted faltet@pytables....
Sat Nov 13 04:21:22 CST 2010


A Friday 12 November 2010 23:38:21 David Cournapeau escrigué:
> On Fri, Nov 12, 2010 at 12:40 AM, Martin Galpin <galpin@gmail.com> 
wrote:
> > Dear all,
> > I am attempting to install SciPy using pip and pypi into a
> > virtualenv. However, because the SciPy egg does not list NumPy as
> > as a dependency, the process cannot be automated using a pip
> > requirements file (the install fails because there is no guarantee
> > of the order pip installs packages and when installing SciPy,
> > NumPy might not be installed).
> > I have verified this is the case on both OS X and Ubuntu 10.10.
> > Can anybody suggest an alternative?
> 
> That's not possible I am afraid. Those tools are pretty limited, and
> cannot express complex dependencies: numpy is a *build* dependency of
> scipy, and scipy setup.py needs numpy to run at all. Neither
> setuptools nor pip support this concept,

Hmm, I think this is actually supported by setuptools.  I'm attaching 
some excerpts of the setup.py in PyTables for dealing with dependencies 
that you may want to use as an example:

"""
# Using ``setuptools`` enables lots of goodies, such as building eggs.
if 'FORCE_SETUPTOOLS' in os.environ:
    from setuptools import setup, find_packages
    has_setuptools = True
else:
    from distutils.core import setup
    has_setuptools = False

# The minimum required versions for dependencies
min_numpy_version = '1.4.1'
min_numexpr_version = '1.4.1'
min_cython_version = '0.13'

# Check for dependencies.
# NumPy (build req.) is absolutely needed at build time...
check_import('numpy', min_numpy_version)
# Check for numexpr (install req.) only if not using setuptools
if not has_setuptools:
    check_import('numexpr', min_numexpr_version)
[clip]

setuptools_kwargs = {}
if has_setuptools:
    # PyTables contains data files for tests.
    setuptools_kwargs['zip_safe'] = False

    # ``NumPy`` headers are needed for building the extensions, as
    # well as Cython.
    setuptools_kwargs['setup_requires'] = [
        'numpy>=%s' % min_numpy_version,
        'cython>=%s' % min_cython_version,
        ]
    # ``NumPy`` and ``Numexpr`` are absolutely required for running 
PyTables.
    setuptools_kwargs['install_requires'] = [
        'numpy>=%s' % min_numpy_version,
        'numexpr>=%s' % min_numexpr_version,
        ]
    setuptools_kwargs['extras_require'] = {
        'Numeric': ['Numeric>=24.2'],  # for ``Numeric`` support
        'netCDF': ['ScientificPython'],  # for netCDF interchange
        'numarray': ['numarray>=1.5.2'],  # for ``numarray`` support
        }
[clip]

setup(name = name,
[clip]
      **setuptools_kwargs)
"""

Hope this helps,

-- 
Francesc Alted


More information about the SciPy-User mailing list