Skip to content

Errors with erfa when running the tests twice (with 1.2rc1) #5082

Closed

Description

@bsipocz

The errors appear when running the tests twice from the same python session (e.g. python -c 'from astropy import test; test(); test()')

These show up on all systems I've tried so far. Also the whole test suite needs to be run, it's not enough to run the tests twice for either the coordinates or time modules.

================================================================================================================== ERRORS ==================================================================================================================
_______________________________________________________________________________________ ERROR collecting coordinates/tests/test_atc_replacements.py ________________________________________________________________________________________
/home/gkovacs/.local/lib/python2.7/site-packages/astropy/coordinates/tests/test_atc_replacements.py:17: in <module>
    from ... import _erfa as erfa
E   ImportError: cannot import name _erfa
_______________________________________________________________________________________ ERROR collecting coordinates/tests/test_atc_replacements.py ________________________________________________________________________________________
/home/gkovacs/.local/lib/python2.7/site-packages/astropy/coordinates/tests/test_atc_replacements.py:17: in <module>
    from ... import _erfa as erfa
E   ImportError: cannot import name _erfa
________________________________________________________________________________________________ ERROR collecting time/tests/test_basic.py _________________________________________________________________________________________________
/home/gkovacs/.local/lib/python2.7/site-packages/astropy/time/tests/test_basic.py:20: in <module>
    from ... import _erfa as erfa
E   ImportError: cannot import name _erfa
________________________________________________________________________________________________ ERROR collecting time/tests/test_basic.py _________________________________________________________________________________________________
/home/gkovacs/.local/lib/python2.7/site-packages/astropy/time/tests/test_basic.py:20: in <module>
    from ... import _erfa as erfa
E   ImportError: cannot import name _erfa
===================================================================================== 10546 passed, 244 skipped, 43 xfailed, 4 error in 139.04 seconds =====================================================================================

Activity

  1. eteq commented on Jun 13, 2016

    @eteq
    Member

    Curious... Can you give platform/version details, @bsipocz? I can't reproduce this on py 3.5 on a Mac (using the builtin pytest)...

  2. eteq commented on Jun 13, 2016

    @eteq
    Member

    Ohhh, turns out it's a py 2.x-only situation. I do get these errors on 2.7, but not 3.x.

    I haven't the slightest idea why this would be happening, though. Maybe something weird with the sorcery that pytest and some of our pytest plugins use to make the tests run in a "safe" environment?

    I think this isn't really a blocker because in the past this has been the case (invoking the tests twice in the same session cause weird pytest-caused errors). As long as actual real use cases don't do this I think we're OK. But it would certainly be useful to try to figure out the root cause of this!

  3. bsipocz commented on Jun 13, 2016

    @bsipocz
    MemberAuthor

    @eteq - I totally agree that this is not a real use case, and only came up as I tend to run the tests twice after one another, first without remote_data. I should just simply switch to the command line, rather than doing it in the interpreter.

    Also you're right that it is a py2 only issue, I can confirm that I can't see it on python3 (lesson learnt, do not have many test runs on several machines at the same time to avoid mess in the reporting.) I've updated the wiki).

    Probably unrelated, but I wonder whether it is normal t have different number of total tests when running them twice (e.g. 8330 vs 8187 for py3)?

  4. eteq commented on Jun 16, 2016

    @eteq
    Member

    Probably unrelated, but I wonder whether it is normal t have different number of total tests when running them twice (e.g. 8330 vs 8187 for py3)?

    I definitely wouldn't call it "normal" ;) there has long been some weirdness in the twice-running situation that I really have never understood...

    I'm labeling this priorty-low because of the easy work around of "quit and re-run the tests", but it would be really good if someone could figure out what's going on just so we can be sure there aren't some subtle problems this is a sign of...

  5. ernest-bart commented on Aug 29, 2016

    @ernest-bart

    Same issue with py2.6 on rhel6 _without_ running 'tests' twice:

    { time python test_astropy_package_tests.py ; } &> test_astropy_package_tests.log

    test_astropy_package_tests.py:
    import astropy
    astropy.test(package='tests',verbose=True)

    test_astropy_package_tests.log:
    WARNING: AstropyDeprecationWarning: Python 2.6 will no longer be supported from Astropy v1.2.0 and above [astropy]
    Internet access disabled
    ============================= test session starts ==============================
    platform linux2 -- Python 2.6.6 -- py-1.4.30 -- pytest-2.7.3 -- /usr/bin/python
    rootdir: /remote/home/renaud/sys_work/sys-175_astropy/results/python-2.6/customized_user_install/rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests, inifile:

    Running tests with Astropy version 1.1.2.
    Running tests in /remote/home/renaud/sys_work/sys-175_astropy/results/python-2.6/customized_user_install/rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests.

    Date: 2016-08-29T14:37:36

    Platform: Linux-2.6.32-431.29.2.el6.x86_64-x86_64-with-redhat-6.4-Santiago

    Executable: /usr/bin/python

    Full Python Version:
    2.6.6 (r266:84292, Aug 9 2016, 06:11:56)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

    encodings: sys: ascii, locale: UTF-8, filesystem: UTF-8, unicode bits: 20
    byteorder: little
    float info: dig: 15, mant_dig: 15

    Numpy: 1.7.2
    Scipy: not available
    Matplotlib: not available
    h5py: not available
    Pandas: not available

    collecting ... collected 46 items

    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warnings_logging_disable_no_enable PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warnings_logging_enable_twice PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warnings_logging_overridden PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warnings_logging PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warnings_logging_with_custom_class PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_warning_logging_with_io_votable_warning PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_import_error_in_warning_logging PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging_disable_no_enable PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging_enable_twice PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging_overridden PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging_origin PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_exception_logging_argless_exception PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list[None] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list[level1] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list[level2] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list[level3] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list[level4] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list_level PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list_origin1 PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_list_origin2 PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file[None] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file[level1] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file[level2] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file[level3] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file[level4] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file_level PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file_origin1 PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/test_logger.py::test_log_to_file_origin2 PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_imports.py::test_imports FAILED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_imports.py::test_toplevel_namespace PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_open_file_detection.py::test_open_file_detection PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_quantity_helpers.py::test_assert_quantity_allclose PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_module_not_found PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_pastebin_keyword PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_unicode_literal_conversion PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_doctest_float_replacement �[?1034hPASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_module_not_found PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_pastebin_keyword PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_unicode_literal_conversion PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_run_tests.py::test_doctest_float_replacement PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_skip_remote_data.py::test_skip_remote_data SKIPPED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_socketblocker.py::test_outgoing_fails PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_socketblocker.py::test_localconnect_succeeds[localhost0] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_socketblocker.py::test_localconnect_succeeds[localhost1] PASSED
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_socketblocker.py::test_multiprocessing_forkserver SKIPPED

    =================================== FAILURES ===================================
    _________________________________ test_imports _________________________________

    def test_imports():
        """
        This just imports all modules in astropy, making sure they don't have any
        dependencies that sneak through
        """
    
        from ...utils import find_current_module
    
        pkgornm = find_current_module(1).__name__.split('.')[0]
    
        if isinstance(pkgornm, six.string_types):
            package = pkgutil.get_loader(pkgornm).load_module(pkgornm)
        elif (isinstance(pkgornm, types.ModuleType) and
                '__init__' in pkgornm.__file__):
            package = pkgornm
        else:
            msg = 'test_imports is not determining a valid package/package name'
            raise TypeError(msg)
    
        if hasattr(package, '__path__'):
            pkgpath = package.__path__
        elif hasattr(package, '__file__'):
            pkgpath = os.path.split(package.__file__)[0]
        else:
            raise AttributeError('package to generate config items for does not '
                                 'have __file__ or __path__')
    
        if six.PY3:
            excludes = _py2_packages
        else:
            excludes = _py3_packages
    
        prefix = package.__name__ + '.'
    
        def onerror(name):
            if not any(name.startswith(excl) for excl in excludes):
                # A legitimate error occurred in a module that wasn't excluded
                raise
    
        for imper, nm, ispkg in pkgutil.walk_packages(pkgpath, prefix,
    
                                                    onerror=onerror):
    

    rhel6/python-2.6/lib/python2.6/site-packages/astropy/tests/tests/test_imports.py:67:


    /usr/lib64/python2.6/pkgutil.py:113: in walk_packages
    onerror(name)
    /usr/lib64/python2.6/pkgutil.py:110: in walk_packages
    import(name)
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/convolution/init.py:6: in
    from .core import *
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/convolution/core.py:25: in
    from .utils import (discretize_model, add_kernel_arrays_1D,
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/convolution/utils.py:7: in
    from ..modeling.core import FittableModel, custom_model
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/modeling/init.py:11: in
    from . import models
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/modeling/models.py:10: in
    from .core import custom_model
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/modeling/core.py:48: in
    from ..nddata.utils import add_array, extract_array
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/nddata/init.py:23: in
    from .utils import *
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/nddata/utils.py:11: in
    from astropy.coordinates import SkyCoord
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/coordinates/init.py:13: in
    from .baseframe import *
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/coordinates/baseframe.py:1181: in
    from .earth import EarthLocation
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/coordinates/earth.py:11: in
    from .builtin_frames import ITRS
    rhel6/python-2.6/lib/python2.6/site-packages/astropy/coordinates/builtin_frames/init.py:44: in
    from . import icrs_cirs_transforms


    """
    from __future__ import (absolute_import, unicode_literals, division,
                            print_function)
    
    import numpy as np
    
    from ... import units as u
    from ..baseframe import frame_transform_graph
    from ..transformations import FunctionTransform
    from ..representation import (SphericalRepresentation, CartesianRepresentation,
                                  UnitSphericalRepresentation)
    

    from ... import _erfa as erfa
    E ImportError: cannot import name _erfa

    rhel6/python-2.6/lib/python2.6/site-packages/astropy/coordinates/builtin_frames/icrs_cirs_transforms.py:17: ImportError
    ----------------------------- Captured stderr call -----------------------------
    WARNING: AstropyDeprecationWarning: Python 2.6 will no longer be supported from Astropy v1.2.0 and above [astropy]
    /remote/home/renaud/sys_work/sys-175_astropy/results/python-2.6/customized_user_install/rhel6/python-2.6/lib/python2.6/site-packages/astropy/analytic_functions/blackbody.py:30: RuntimeWarning: overflow encountered in expm1
    _has_buggy_expm1 = np.isnan(np.expm1(1000))
    ================ 1 failed, 43 passed, 2 skipped in 1.57 seconds ================

    real 0m3.582s
    user 0m1.659s
    sys 0m0.688s

  6. ernest-bart commented on Aug 29, 2016

    @ernest-bart

    Please note also in previous log the presence of garbled characters in test_run_tests.py::test_doctest_float_replacement test result

  7. pllim commented on Aug 29, 2016

    @pllim
    Member

    Is Python 2.6 still relevant? We already dropped Python 2.6 support.

  8. bsipocz commented on Sep 1, 2016

    @bsipocz
    MemberAuthor

    I agree with @pllim. py2.6 fails is still relevant only for the LTS, for any other cases please upgrade the installs to get rid of the errors.

  9. ernest-bart commented on Sep 2, 2016

    @ernest-bart

    Answering pllim's "Is Python 2.6 still relevant?" question:

    Good question !
    The short answer is: yes.

    The longer answer is:
    Our Quality Assurance team is working with CASA but would like to be able to use Astropy in the same RHEL6 environment, which is py2.6 by default.

    But since recent CASA versions ship with their own "private" py2.7 (older versions had py2.6),
    I first installed the latest Astropy from CASA 4.5.3 (py2.7).
    Unfortunately, Astropy tests resulted in segmentation fault on 2 modules:

    • modeling
    • wcs

    So I reverted to install Astropy with RHEL6 py2.6, which required to downgrade Astropy version to 1.1.2.
    This fixed the seg. fault issues in modeling and wcs, but:

    • test_imports FAILED
    • 2 wcs tests are xpassed. (unexpectedly pass)
  10. astrofrog commented on Sep 2, 2016

    @astrofrog
    Member

    @ernest-bart - just to be clear:

    • The only version of Astropy we still support on Python 2.6 is the 1.0.x (LTS) branch. We can still fix bugs with that version.
    • There will be no more 1.1.x releases, so we cannot fix issues there
    • Astropy 1.2.x and future versions do not support Python 2.6

    I would therefore recommend using the 1.0.x release series in your quality assurance environment since we can still fix issues there.

  11. ernest-bart commented on Sep 5, 2016

    @ernest-bart

    @astrofrog

    Thank you for the clarification.

    Following your recommendation here is an update on rhel6 + astropy 1.0.10

    • test_imports: PASS
    • the 2 wcs XPASS tests are the followings. Can these XPASS be safely ignored ?

    astropy.test(test_path='/opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests/test_wcsprm.py',verbose=True)
    Internet access disabled
    =================================================================== test session starts ====================================================================
    platform linux2 -- Python 2.6.6 -- py-1.4.30 -- pytest-2.7.3 -- /usr/bin/python
    rootdir: /opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests, inifile:

    Running tests with Astropy version 1.0.10.
    Running tests in /opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests/test_wcsprm.py.

    Platform: Linux-2.6.32-504.el6.x86_64-x86_64-with-redhat-6.4-Santiago

    Executable: /usr/bin/python

    Full Python Version:
    2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
    [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

    encodings: sys: ascii, locale: UTF-8, filesystem: UTF-8, unicode bits: 20
    byteorder: little
    float info: dig: 15, mant_dig: 15

    Numpy: 1.7.2
    Scipy: not available
    Matplotlib: not available
    h5py: not available

    collected 99 items

    ... : Note: deleted first passed tests results
    ../../../opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests/test_wcsprm.py::test_compare PASSED
    ../../../opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests/test_wcsprm.py::test_radesys_defaults XPASS
    ../../../opt/share/python-packages/rhel6/python-2.6/lib/python2.6/site-packages/astropy/wcs/tests/test_wcsprm.py::test_radesys_defaults_full XPASS

    =========================================================== 97 passed, 2 xpassed in 0.24 seconds ===========================================================

  12. bsipocz commented on Jun 26, 2017

    @bsipocz
    MemberAuthor

    I'm not sure whether this has been fixed or just worked around, but I don't see the issue any more on current master.

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