scipy: BLD: pip build from source fails in `_stats_pythran` with PyPy3.11

Describe your issue.

build fails using pypy3.11-v7.3.18

Reproducing Code Example

both of

pip3 install scipy==1.15.2

and

git clone https://github.com/scipy/scipy
cd scipy
git submodule update --init
pip3 install .

fails.

Error message

[551/1466] Generating 'scipy/stats/_stats_pythran.pypy311-pp73-x86_64-linux-gnu.so.p/_stats_pythran.cpp'
      FAILED: scipy/stats/_stats_pythran.pypy311-pp73-x86_64-linux-gnu.so.p/_stats_pythran.cpp
      /tmp/pip-build-env-8fm34ex_/overlay/bin/pythran -E ../scipy/stats/_stats_pythran.py -o scipy/stats/_stats_pythran.pypy311-pp73-x86_64-linux-gnu.so.p/_stats_pythran.cpp
      WARNING: Overriding pythran description with argspec information for: numpy.arange
      WARNING: Overriding pythran description with argspec information for: numpy.array
      WARNING: Overriding pythran description with argspec information for: numpy.concatenate
      WARNING: Overriding pythran description with argspec information for: numpy.empty
      WARNING: Overriding pythran description with argspec information for: numpy.empty_like
      WARNING: Overriding pythran description with argspec information for: numpy.fromiter
      WARNING: Overriding pythran description with argspec information for: numpy.fromfile
      WARNING: Overriding pythran description with argspec information for: numpy.zeros
      CRITICAL: I am in trouble. Your input file does not seem to match Pythran's constraints...
      ../scipy/stats/_stats_pythran.py:187:10 error: function uses an unknown (or unsupported) keyword argument `dtype`
      ----
          pmf = np.zeros(n + 1, dtype=np.float64)
                ^~~~ (o_0)
      ----

SciPy/NumPy/Python version and system information

SciPy: 1.15.2 and head
Python: pypy3.11-v7.3.18-linux64

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Fixed in PyPy via pypy/pypy#5227 will be part of an upcoming bug-fix release. Thanks for trying out the first PyPy3.11 release.

yes. Here is a simple pypy scession that showcases the issue:

>>>> import inspect, numpy
>>>> inspect.getfullargspec(numpy.zeros)
FullArgSpec(args=['self'], varargs='args', varkw='keywords', defaults=None, kwonlyargs=[], kwonlydefaults=None, annotations={})
>>>> inspect.getfullargspec(numpy.ones)
FullArgSpec(args=['shape', 'dtype', 'order'], varargs=None, varkw=None, defaults=(None, 'C'), kwonlyargs=['device', 'like'], kwonlydefaults={'device': None, 'like': None}, annotations={})

basically the introspection for numpy.zeros seems to be incomplete (if not incorrect)