Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure with PyPy 7.3.12 #176

Open
lithomas1 opened this issue Aug 31, 2023 · 6 comments
Open

Failure with PyPy 7.3.12 #176

lithomas1 opened this issue Aug 31, 2023 · 6 comments

Comments

@lithomas1
Copy link
Contributor

lithomas1 commented Aug 31, 2023

Traceback (most recent call last):
  File "/Users/runner/miniforge3/conda-bld/pandas_1693426048240/test_tmp/run_test.py", line 2, in <module>
    import pandas
  File "/Users/runner/miniforge3/conda-bld/pandas_1693426048240/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/pypy3.9/site-packages/pandas/__init__.py", line 46, in <module>
    from pandas.core.api import (
  File "/Users/runner/miniforge3/conda-bld/pandas_1693426048240/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/pypy3.9/site-packages/pandas/core/api.py", line 1, in <module>
    from pandas._libs import (
  File "/Users/runner/miniforge3/conda-bld/pandas_1693426048240/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/pypy3.9/site-packages/pandas/_libs/__init__.py", line 18, in <module>
    from pandas._libs.interval import Interval
TypeError: type 'cython_function_or_method' is not an acceptable base type

Do I need Cython 3 for this to work?
(pandas is currently pinned to 0.29.36 since we have some perf regressions on Cython 3)
cc @mattip

@mattip
Copy link

mattip commented Aug 31, 2023

Could you give a little more syntax? Where did you see this failure? I am still working according to this game plan but I am seeing a different failure, something around DateTimeIndex, when I try to "turn on" pypy testing in upstream pandas in a PR to my fork, here is the error I am seeing.

I know what is happening: somehow the creation of a _Timestamp is not correctly filling in the C side of the "PyPy object + C object" pair, so obj.tzinfo returns a value but this cython macro fails:

((((PyDateTime_DateTime*)o)->hastzinfo) ? ((PyDateTime_DateTime*)o)->tzinfo : Py_None)

I need to whittle that failure down to a smaller reproducer so I can figure out why it happens.

@lithomas1
Copy link
Contributor Author

Sorry for the lack of info.

I'm getting this failure when I import pandas. Maybe this is something conda-forge specific since it doesn't happen in your testing?

(You are also compiling with Cython 3.0 there, I'll give that a shot here)

@rcurtin
Copy link

rcurtin commented Sep 26, 2023

This can be reproduced with the condaforge/miniforge-pypy3:latest Docker container... I did it like this:

$ docker run -it condaforge/miniforge-pypy3:latest /bin/bash
...
# conda install pandas
...
# python3
Python 3.9.17 | packaged by conda-forge | (3f3f2298, Sep 03 2023, 20:18:49)
[PyPy 7.3.12 with GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/__init__.py", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev  # pyright: ignore # noqa:F401
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/compat/__init__.py", line 25, in <module>
    from pandas.compat.numpy import (
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/compat/numpy/__init__.py", line 4, in <module>
    from pandas.util.version import Version
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/util/__init__.py", line 2, in <module>
    from pandas.util._decorators import (  # noqa:F401
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/util/_decorators.py", line 14, in <module>
    from pandas._libs.properties import cache_readonly
  File "/opt/conda/lib/pypy3.9/site-packages/pandas/_libs/__init__.py", line 13, in <module>
    from pandas._libs.interval import Interval
TypeError: type 'cython_function_or_method' is not an acceptable base type

We're encountering this downstream in conda-forge/mlpack-feedstock#48; would be happy to put some workaround in place, but I'm not quite sure what to do.

Thanks!

@lithomas1
Copy link
Contributor Author

To give an update, this looks like a PyPy bug
conda-forge/pypy3.6-feedstock#109

@bashtage
Copy link

It is not pypy specific. Also gappend with CPython. See the log in #180.

@lithomas1
Copy link
Contributor Author

lithomas1 commented Sep 29, 2023

I see a PyPy log. It shows as PyPy 3.9 for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants