Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Numpy with pypy

Tags:

python

pypy

numpy

I am using some numpy tools (mainly arrays) and I wanted to run the script with pypy, but i can't make it work.

The error that i get is: ImportError: No module named multiarray.

I checked if the multiarray.so file was in the core folder.

Can someone tell me if first: is possible to do what I am trying to do and second: How can I do it?

like image 523
nunolourenco Avatar asked May 04 '11 13:05

nunolourenco


People also ask

Can you use NumPy in 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 PyPy compatible with Python?

Compatibility: PyPy is highly compatible with existing python code. It supports cffi, cppyy, and can run popular python libraries like twisted, and django. It can also run NumPy, Scikit-learn and more via a c-extension compatibility layer.

Can I use pip with PyPy?

Pip/pip3 is the official package manager for Python, but it can also be used by PyPy for installing Python modules.

How do I run Python code in PyPy?

For Python 2.7, it's just called pypy . For CPython, if you would like to run Python 3 from the terminal, you simply enter the command python3 . To run PyPy, simply issue the command pypy3 . Entering the pypy3 command in the terminal might return the Command 'pypy3' not found message, as shown in the next figure.


2 Answers

I've just posted a blog post explaining what's the status and what's the plan. In short numpy will not work with PyPy's cpyext and even if it does, it would be too slow for usage.

like image 56
fijal Avatar answered Sep 19 '22 17:09

fijal


The other answers are quite old.

Here is the the completely unscientific measure of "implemented functions" on numpypy status page

Some posts from the pypy blog about numpy:

  1. MAY 4, 2011
  2. MAY 5, 2011
  3. APRIL 17, 2012
  4. SEPTEMBER 4, 2012
  5. NOVEMBER 1, 2012
  6. MARCH 18, 2013
  7. MAY 11, 2013
  8. DECEMBER 10, 2013
like image 34
Augusto Hack Avatar answered Sep 19 '22 17:09

Augusto Hack