wannesm / dtaidistance

Time series distances: Dynamic Time Warping (fast DTW implementation in C)
Other
1.08k stars 184 forks source link

PyPy support #177

Open m-rossi opened 2 years ago

m-rossi commented 2 years ago

conda-forge recently started a migration for PyPy 3.8 and PyPy 3.9: https://github.com/conda-forge/dtaidistance-feedstock/pull/11

The builds seems fine, however the import tests fail

import: 'dtaidistance'
Traceback (most recent call last):
  File "D:\bld\dtaidistance_1661547543219\test_tmp\run_test.py", line 2, in <module>
    import dtaidistance
  File "D:\bld\dtaidistance_1661547543219\_test_env\lib\site-packages\dtaidistance\__init__.py", line 19, in <module>
    from . import dtw
  File "D:\bld\dtaidistance_1661547543219\_test_env\lib\site-packages\dtaidistance\dtw.py", line 18, in <module>
    from . import util
  File "D:\bld\dtaidistance_1661547543219\_test_env\lib\site-packages\dtaidistance\util.py", line 31, in <module>
    from . import dtw_cc
  File "dtaidistance\dtw_cc.pyx", line 1, in init dtaidistance.dtw_cc
    """
ValueError: array.array size changed, may indicate binary incompatibility. Expected 72 from C header, got 24 from PyObject

Have you tried supporting PyPy for dtaidistance?

wannesm commented 2 years ago

Thanks for testing. I haven't tried before to support PyPy and can recreate the error. But what I get from the Cython issues is that array.array is not supported for PyPy: https://github.com/cython/cython/issues/1818 . It would thus require refactoring the Cython code to get it to work in PyPy (unless I'm overlooking something).

m-rossi commented 2 years ago

Ok, i will put the PR in "Draft mode" then (Migrators and Migrations) to show it is currently not supported.