20

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?

eumiro
  • 207,213
  • 34
  • 299
  • 261
nunolourenco
  • 699
  • 2
  • 8
  • 18
  • 2
    I just found an answer (sort of) to this problem in Hacker News. Here is the link, in case someone need it: http://morepypy.blogspot.com/2011/05/numpy-in-pypy-status-and-roadmap.html – nunolourenco May 04 '11 at 20:37

5 Answers5

21

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.

fijal
  • 3,190
  • 18
  • 21
16

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
Augusto Hack
  • 2,032
  • 18
  • 35
10

Numpy status and build instruction has been changed recently. There is a special version of numpy which is ported to PyPy. If you want to get latest instruction just check PyPy blog for a latest article about Numpy. For the time of writing the latest instruction are in this post, which compiles to:

 pip install git+https://bitbucket.org/pypy/numpy.git

For what is implemented and what not you can check this page: http://buildbot.pypy.org/numpy-status/latest.html

Robert Zaremba
  • 8,081
  • 7
  • 47
  • 78
6

Previous answers now are obsolete :) http://morepypy.blogspot.com/2011/08/pypy-16-kickass-panda.html

The CPython extension module API has been improved and now supports many more extensions. For information on which one are supported, please refer to our compatibility wiki.

Preliminary support for NumPy: this release includes a preview of a very fast NumPy module integrated with the PyPy JIT.

user781903
  • 153
  • 1
  • 3
  • The NumPy support doesn't come from the "CPython extension module API", it's a partial re-implementation just like @fijal described in the link in his answer. – TryPyPy Aug 19 '11 at 16:26
  • 3
    Calling numpy what's in pypy is quite misleading. The code included in pypy is a new array class which tries to be compatible with numpy, IOW, it is a reimplementation from scratch, without many features from numpy. If all you need is an array with fast per-item operation, that's great, but that's nowhere near a numpy replacement at this point. – David Cournapeau Sep 01 '11 at 13:38
5

As far as I know, Numpy has never been succesfully ported to PyPy, and it is not trivial to do so as the C API for PyPy is different from the cPython one.

See also http://ademan.wordpress.com/category/code/pypy/ for the blog of someone that tried.

wump
  • 4,277
  • 24
  • 25