Closed saimn closed 1 year ago
Just ran these tests in a clean Python 3.11 conda environment with the latest pyerfa
release on an M1 Mac and the tests all run fine, so perhaps this could be closed?
EDIT: when compiling from source, the tests also pass for me.
Thanks @jobovy, closing. @saimn please feel free to re-open if things still do not work for you.
Still fails if I install from source:
=================================================================================== short test summary info ====================================================================================
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::test_erfa_wrapper - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::test_errwarn_reporting - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::test_vector_inouts - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::test_rz - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::test_float32_input - numpy.core._exceptions._UFuncNoLoopError: ufunc 'p2s' did not contain a loop with signature matching types <class 'numpy.dtype[float32]'> -> (None, None, None)
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::TestLeapSeconds::test_set_leap_seconds - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::TestLeapSeconds::test_validation[table0-January] - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::TestLeapSeconds::test_validation[table1-jump] - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::TestLeapSeconds::test_validation[table2-dimension] - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_erfa.py::TestLeapSeconds::test_update_leap_seconds - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_ab - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_c2ibpn - numpy.core._exceptions._UFuncNoLoopError: ufunc 'c2ibpn' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>, <class 'numpy.dt...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_c2ixy - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_c2tcio - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_c2teqx - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_cal2jd - numpy.core._exceptions._UFuncNoLoopError: ufunc 'cal2jd' did not contain a loop with signature matching types (<class 'numpy.dtype[int64]'>, <class 'numpy.dtype[int64]'>, <class 'numpy.dt...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_dat - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_eform - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_eors - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_epj - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_gc2gd - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_gc2gde - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_gd2gc - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_gst06 - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_ld - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_ldsun - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_num00b - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_num06a - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_pmpx - numpy.core._exceptions._UFuncNoLoopError: ufunc 'pmpx' did not contain a loop with signature matching types (<class 'numpy.dtype[float64]'>, <class 'numpy.dtype[float64]'>, <class 'numpy....
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_ppsp - numpy.core._exceptions._UFuncNoLoopError: ufunc 'ppsp' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>, <class 'numpy.dtyp...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_pr00 - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_rx - numpy.core._exceptions._UFuncNoLoopError: ufunc 'rx' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>) -> <class 'numpy.dty...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_ry - numpy.core._exceptions._UFuncNoLoopError: ufunc 'ry' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>) -> <class 'numpy.dty...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_rz - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_sxp - ValueError: Invalid data-type for array
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_tporv - numpy.core._exceptions._UFuncNoLoopError: ufunc 'tporv' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>, <class 'numpy.dty...
FAILED .pyenv/versions/erfa/lib/python3.11/site-packages/erfa/tests/test_ufunc.py::test_tpstv - numpy.core._exceptions._UFuncNoLoopError: ufunc 'tpstv' did not contain a loop with signature matching types (<class 'numpy.dtype[bool_]'>, <class 'numpy.dtype[bool_]'>, <class 'numpy.dty...
========================================================================== 37 failed, 240 passed, 1 skipped in 2.56s ===========================================================================
Something seems broken in the ufunc logic, scalar work but not numpy arrays:
In [1]: import numpy as np
...: import erfa
In [2]: jd = np.linspace(2456855.5, 2456855.5+1.0/24.0/60.0, 60*2+1)
In [3]: erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd[0],
...: 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
Out[3]:
(1.8822287856305961,
1.2705653897567488,
-1.1416413766713571,
0.002139101854684246,
6.282590269689792,
-0.0032873592390111742)
In [4]: erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd,
...: 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[4], line 1
----> 1 erfa.atco13(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, jd,
2 0.0, 0.0, 0.0, np.pi/4.0, 0.0, 0.0, 0.0, 1014.0, 0.0, 0.0, 0.5)
File ~/dev/pyerfa/erfa/core.py:3406, in atco13(rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
3218 def atco13(rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl):
3219 """
3220 ICRS RA,Dec to observed place. The caller supplies UTC, site
3221 coordinates, ambient air conditions and observing wavelength.
(...)
3404
3405 """
-> 3406 aob, zob, hob, dob, rob, eo, c_retval = ufunc.atco13(
3407 rc, dc, pr, pd, px, rv, utc1, utc2, dut1, elong, phi, hm, xp, yp, phpa, tc, rh, wl)
3408 check_errwarn(c_retval, 'atco13')
3409 return aob, zob, hob, dob, rob, eo
ValueError: Invalid data-type for array
I confirm that I cannot reproduce the issue. @saimn did you try to reproduce the issue in an environment different from pyenv?
I got the tests passing with a miniconda env, which lead me to the reason: this is caused by using -O3
, all is fine with -O2
.
Yikes, thanks for all the sleuthing! As noted in #104, I'm definitely happy to put the solution in. But also should check to what extent our own type resolver is still necessary - numpy has fixed some of the problems that forced me to write it...
While installing pyerfa from source (as an Astropy dependency) on Python 3.11, I get this error with the ufunc calls. For exemple, running tests from the installed package results in these errors:
Failure example:
Astropy's CI on Python 3.11 is not failing, so I don't know, maybe something due to the GCC version ?
When building from source I get many "incompatible pointer type" warnings, and a "dangling pointer" one: