1

I just tried to install package scipy==1.8.0 under pypy (version 3.8) .

pip install scipy==1.8.0

Firstly, the scipy installation process was failed with the following warnings and errors:

Building wheels for collected packages: scipy
  Building wheel for scipy (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for scipy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [1198 lines of output]



WARN: Could not locate executable armflang
WARN: Could not locate executable gfortran
WARN: Could not locate executable f95
WARN: Could not locate executable ifort
WARN: Could not locate executable ifc
WARN: Could not locate executable lf95
WARN: Could not locate executable pgfortran
WARN: Could not locate executable nvfortran
WARN: Could not locate executable f90
WARN: Could not locate executable f77
WARN: Could not locate executable fort
WARN: Could not locate executable efort
WARN: Could not locate executable efc
WARN: Could not locate executable g77
WARN: Could not locate executable g95
WARN: Could not locate executable pathf95
WARN: Could not locate executable nagfor
WARN: Could not locate executable frt
WARN: don't know how to compile Fortran code on platform 'posix'


error: library mach has Fortran sources but no Fortran compiler found

Secondly, I installed gfortan with the following code:

sudo apt-get install gfortran

and then the scipy installation process was failed with the following error:

compilation terminated.
  INFO: gcc: scipy/special/cephes/beta.c
  In file included from scipy/special/cephes/bdtr.c:149:
  scipy/special/cephes/mconf.h:56:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  INFO: gcc: scipy/special/cephes/btdtr.c
  INFO: gcc: scipy/special/cephes/cbrt.c
  INFO: gcc: scipy/special/cephes/chbevl.c
  In file included from scipy/special/cephes/beta.c:49:
  scipy/special/cephes/mconf.h:56:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  In file included from scipy/special/cephes/besselpoly.c:1:
  scipy/special/cephes/mconf.h:56:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  INFO: gcc: scipy/special/cephes/chdtr.c
  In file included from scipy/special/cephes/btdtr.c:53:
  scipy/special/cephes/mconf.h:56:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  INFO: gcc: scipy/special/cephes/const.c
  INFO: gcc: scipy/special/cephes/dawsn.c
  In file included from scipy/special/cephes/chbevl.c:60:
  scipy/special/cephes/mconf.h:56:10: fatal error: Python.h: No such file or directory
   #include <Python.h>


ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects

I also tried:

  • Upgrading pip,setuptools and wheel
  • some other versions of scipy (1.9.0, ,1.7.0, 1.6.0).

I was wondering if there is a solution to this issue and if scipy is compatible with pypy.

  • Does this answer your question? [python.h not fond when trying to install gevent-socketio](https://stackoverflow.com/questions/20582707/python-h-not-fond-when-trying-to-install-gevent-socketio) – Sören Aug 16 '22 at 21:29

2 Answers2

2

Thank you for your reply.

I just followed these steps and the issue was solved.

sudo apt install libblas3 liblapack3 liblapack-dev libblas-dev

sudo apt install gfortran

pip install --extra-index-url https://antocuni.github.io/pypy-wheels/manylinux2010 scipy==1.8.0
0

I would strongly recommend using pre-compiled binaries as available via conda-forge. Compiling scipy is not a trivial task. Maybe someday pip install --only-binary :all: will support PyPy, see this issue

mattip
  • 2,360
  • 1
  • 13
  • 13
  • for "Compiling scipy" needed [Numpy+MKL](https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) : "Numpy+MKL is linked to the **Intel® Math Kernel Library** and includes required DLLs in the numpy.DLLs directory", scipy.whl also at that link. ++ [Installing from Wheels](https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels) – JeeyCi Jan 07 '23 at 02:06
  • [wheel](https://stackoverflow.com/a/44099107/15893581) install first, further file.whl – JeeyCi Jan 07 '23 at 03:33