Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to install scipy under pypy?

Tags:

pypy

numpy

scipy

I created a virtualenv with pypy and tried to install scipy, but installation ended with the following error:

distutils.errors.DistutilsError: Setup script exited with error: Command "cc -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=1 -DHAVE_CBLAS -Ibuild/src.linux-x86_64-3.2/numpy/core/src/private -Inumpy/core/include -Ibuild/src.linux-x86_64-3.2/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/home/luke/Programowanie/Python/connect4/venv-pypy/include -Ibuild/src.linux-x86_64-3.2/numpy/core/src/private -Ibuild/src.linux-x86_64-3.2/numpy/core/src/private -Ibuild/src.linux-x86_64-3.2/numpy/core/src/private -c numpy/core/src/multiarray/scalarapi.c -o build/temp.linux-x86_64-3.2/numpy/core/src/multiarray/scalarapi.o" failed with exit status 1

There is a specific numpy version suited for pypy, but the only thing I found about scipy is an old call for donations. Has anything changed since then?

like image 477
Luke Avatar asked Jan 11 '16 19:01

Luke


People also ask

How do I add SciPy to Python?

Type and run pip install scipy in the command prompt. This will use the Python Package index, and install the core SciPy packages on your computer. You can also install other core packages like Numpy and Matplotlib by using the pip install numpy and pip install matplotlib commands.

Does NumPy work with PyPy?

TL;DR version: you should use numpy. You can install it by doing pypy -m pip install numpy . You might also be interested in using the experimental PyPy binary wheels to save compilation time. The upstream numpy is written in C, and runs under the cpyext compatibility layer.

Is SciPy written in C?

SciPy wraps highly-optimized implementations written in low-level languages like Fortran, C, and C++. Enjoy the flexibility of Python with the speed of compiled code.


1 Answers

Yes, it is possible, starting from Scipy 1.1.0. New enough PyPy (>= 6.0.0) and Numpy are however required, numpy>= 1.14.3, and preferably numpy>=1.15.0 when it's released. Installation can be done via the usual

pypy3 -mpip install numpy
pypy3 -mpip install scipy

assuming you have BLAS/LAPACK installed, so first you should make sure you are able to install numpy/scipy on normal Python from sources.

Nobody probably has tried whether this works with Pypy on Windows, so you are on your own there. It also probably won't work with NumPyPy --- you need the vanilla Numpy.

The other answers say "No" since that was the situation before May 2018.

like image 155
pv. Avatar answered Sep 22 '22 06:09

pv.