Friday, November 15, 2013

NumPy status update

Here is what has been happening with NumPy in PyPy in October thanks to the people who donated to the NumPyPy proposal:

The biggest change is that we shifted to using an external fork of numpy rather than a minimal numpypy module. The idea is that we will be able to reuse most of the upstream pure-python numpy components, replacing the C modules with appropriate RPython micronumpy pieces at the correct places in the module namespace.

The numpy fork should work just as well as the old numpypy for functionality that existed previously, and also include much new functionality from the pure-python numpy pieces that simply hadn't been imported yet in numpypy. However, this new functionality will not have been "hand picked" to only include pieces that work, so you may run into functionality that relies on unimplemented components (which should fail with user-level exceptions).

This setup also allows us to run the entire numpy test suite, which will help in directing future compatibility development. The recent PyPy release includes these changes, so download it and let us know how it works! And if you want to live on the edge, the nightly includes even more numpy progress made in November.

To install the fork, download the latest release, and then install numpy either separately with a virtualenv: pip install git+https://bitbucket.org/pypy/numpy.git; or directly: git clone https://bitbucket.org/pypy/numpy.git; cd numpy; pypy setup.py install.

EDIT: if you install numpy as root, you may need to also import it once as root before it works: sudo pypy -c 'import numpy'

Along with this change, progress was made in fixing internal micronumpy bugs and increasing compatibility:
  • Fixed a bug with strings in record dtypes
  • Fixed a bug where the multiplication of an ndarray with a Python int or float resulted in loss of the array's dtype
  • Fixed several segfaults encountered in the numpy test suite (suite should run now without segfaulting)

We also began working on __array_prepare__ and __array_wrap__, which are necessary pieces for a working matplotlib module.

Cheers,
Romain and Brian

5 comments:

Anonymous said...

Hi,

Thanks for all your efforts on pypy-*, we really appreciate it!

I'm trying to compile numpy with pypy-2.2-osx64 but the building process (manual and pip) fails with:
AttributeError: 'module' object has no attribute 'get_makefile_filename'

Full build log: http://pastebin.com/S4dybCV0

Any idea how to resolve this?

Thanks,
t

Maciej Fijalkowski said...

Hey

Please put such reports to bugs.pypy.org so they don't get lost.

Thanks!
fijal

Brian Kearns said...

Installation on OS X was fixed.

Anonymous said...

I am getting an error when installing numpy for pypy 2.2.1:

http://stackoverflow.com/questions/22342769/error-when-installing-numpy-for-pypy2-2-1

Anonymous said...

I am getting an error when installing numpy for pypy 2.2.1:

http://stackoverflow.com/questions/22342769/error-when-installing-numpy-for-pypy2-2-1