Skip to content

[1.3] version comparison fails with numpy 1.12.0b1 #5643

Description

@olebole

With astropy 1.3 and numpy 1.12.0b1, many affiliated packages now fail in the tests when the numpy version number is compared. For example aplpy:

Traceback (most recent call last):
  File "debian/tests/python3-aplpy", line 7, in <module>
    import aplpy
  File "/usr/lib/python3/dist-packages/aplpy/__init__.py", line 9, in <module>
    from ._astropy_init import *
  File "/usr/lib/python3/dist-packages/aplpy/_astropy_init.py", line 116, in <module>
    from astropy import config
  File "/usr/lib/python3/dist-packages/astropy/__init__.py", line 116, in <module>
    _check_numpy()
  File "/usr/lib/python3/dist-packages/astropy/__init__.py", line 104, in _check_numpy
    from .utils import minversion
  File "/usr/lib/python3/dist-packages/astropy/utils/__init__.py", line 20, in <module>
    from .compat.odict import OrderedDict
  File "/usr/lib/python3/dist-packages/astropy/utils/compat/__init__.py", line 14, in <module>
    from .numpycompat import *
  File "/usr/lib/python3/dist-packages/astropy/utils/compat/numpycompat.py", line 24, in <module>
    NUMPY_LT_1_12 = not minversion('numpy', '1.12dev')
  File "/usr/lib/python3/dist-packages/astropy/utils/introspection.py", line 159, in minversion
    return parse_version(have_version) >= parse_version(version)
  File "/usr/lib/python3.5/distutils/version.py", line 70, in __ge__
    c = self._cmp(other)
  File "/usr/lib/python3.5/distutils/version.py", line 337, in _cmp
    if self.version < other.version:
TypeError: unorderable types: int() < str()

Activity

  1. mhvk commented on Dec 24, 2016

    @mhvk
    Contributor

    I put that 1.12dev in to be able to test with the recent numpy, but maybe now it can be changed to just 1.12?
    Although ideally we fix this in a better way...

  2. mhvk commented on Dec 24, 2016

    @mhvk
    Contributor

    Part of the problem is that how parse_version is imported in min_version:

        try:
            from pkg_resources import parse_version
        except ImportError:
            from distutils.version import LooseVersion as parse_version
    

    The version from pkg_resources works fine, but that from distutils.version does not.

    Anyway, an attempt to solve it in #5646.

  3. mhvk commented on Dec 24, 2016

    @mhvk
    Contributor

    So, possibly the solution is to depend on pkg_resources...

  4. astrofrog commented on Dec 25, 2016

    @astrofrog
    Member

    We already have setuptools (well, pkg_resources) as an optional dependency for astropy.modeling.fitters I think, so maybe we could upgrade to having setuptools as a full required dependency.

  5. mhvk commented on Jan 7, 2017

    @mhvk
    Contributor

    I merged #5646, which should solve the problems for affiliated packages. Still not quite sure whether longer-term we should requite setuptools or whether we should be stricter about what version numbers to use in the comparisons.

  6. bsipocz commented on Jun 26, 2017

    @bsipocz
    Member

    Closing as this seems to have been solved. Please reopen if you run into it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions