3

I've installed numpy in the recommended way for PyPy 6.0:

./pypy -m ensurepip
./pip install -U pip wheel
./pypy -m pip install numpy

However, this does not work (on Ubuntu 16.04): this installation succeeds but I get the following when I try to import numpy:

Python 2.7.13 (ab0b9caf307d, Apr 24 2018, 18:04:42)
[PyPy 6.0.0 with GCC 6.2.0 20160901] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy as np
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jwimberl/src/pypy2-v6.0.0-linux64/site-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/home/jwimberl/src/pypy2-v6.0.0-linux64/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
  File "/home/jwimberl/src/pypy2-v6.0.0-linux64/site-packages/numpy/core/multiarray.py", line 44, in <module>
    arange.__module__ = 'numpy'
TypeError: readonly attribute '__module__'

I've seen other questions on SO about pypy/numpy but they are all >3 years old and I'm not sure they are up to date.

1 Answer 1

5

There's an incompatibility between numpy 1.16.0 and pypy-v6.0, more details here. It'll be fixed in the next pypy release (coming soon), but in the mean time, you should probably use numpy 1.15.4 instead (e.g. using ./pypy -m pip install 'numpy<1.16').

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Somehow I didn't find this result when googling around, thought the error was quite similar (the github issue pops up as an 'AttributeError' during installation of a dependent package, whereas I got the 'TypeError' during import).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.