Raising errors in setup.py breaks installations which depend on cfunits

Issue #6 closed
Nathan Collier created an issue

In your setup.py file, you have a block which checks for the presence of dependencies:

# Check that the dependencies are met
for _module in ('netCDF4', 'numpy'):
    try:
        imp.find_module(_module)
    except ImportError as error:
        raise ImportError("Missing dependency. cf requires package %s. %s" %
                          (_module, error))

But this is what the "requires" keyword is doing in your call to setup() later in the script. This ImportError you raise causes anyone else who depends on you (which we do :)) to fail on install:

-bash-4.1$ pip install ./ --user --upgrade
Processing /autofs/nccs-svm1_home1/nate/ilamb
Requirement already up-to-date: numpy>=1.9.2 in /autofs/nccs-svm1_home1/nate/.local/lib/python2.7/site-packages (from ILAMB==2.0.2)
Requirement already up-to-date: matplotlib>=1.4.3 in /autofs/nccs-svm1_home1/nate/.local/lib/python2.7/site-packages (from ILAMB==2.0.2)
Collecting netCDF4>=1.1.4 (from ILAMB==2.0.2)
  Using cached netCDF4-1.2.7-cp27-cp27m-manylinux1_x86_64.whl
Collecting cfunits>=1.1.4 (from ILAMB==2.0.2)
  Using cached cfunits-1.3.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-qhkjMK/cfunits/setup.py", line 40, in <module>
        (_module, error))
    ImportError: Missing dependency. cfunits requires package netCDF4. No module named netCDF4

As you can see, we also require netCDF4 and it is downloaded and ready to install, but your ImportError halts the installation process. Do you really need it? Doesn't "requires" get the job done? If you do really need it, can you move it to init?

Thanks!

Comments (1)

  1. Log in to comment