I downloaded the prebuilt binary pypy-5.1.1-osx64, dropped it into my
homedir, and built a virtualenv using it. The files look like they
were built Apr. 30th, I installed May 11th. I don't think that I've
installed numpy-specific C libs for the cpython numpy I also have
installed, but this system is old enough that I might have. If that
becomes relevant, I can dig in more.

First I installed numpy by following the instructions here:
http://pypy.org/download.html#installing-numpy  IIRC, I just used the
virtualenv pip to do it.

Then when I started to notice the difference in behavior between
cpython and pypy, I ended up messing around a bit (wondering if the
slight version difference was important, etc.) and ended up going into
the pypy venv site-packages and doing rm -rf numpy* to get a clean
slate, then doing a git clone of the pypy/numpy repo and doing pypy
setup.py install, as directed here: https://bitbucket.org/pypy/numpy

Then I run this:

    pypy -c "import numpy; numpy.test('doesntexist')"

And get (among a lot of other noise):

======================================================================
ERROR: Failure: ImportError (No module named numpy.core.multiarray_tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/elis/venv/droidblue-pypy/site-packages/nose/loader.py",
line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/elis/venv/droidblue-pypy/site-packages/nose/importer.py",
line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/elis/venv/droidblue-pypy/site-packages/nose/importer.py",
line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File 
"/Users/elis/venv/droidblue-pypy/site-packages/numpy/core/tests/test_multiarray.py",
line 22, in <module>
    from numpy.core.multiarray_tests import (
ImportError: No module named numpy.core.multiarray_tests

Commenting out those imports results in the datetime64 issue I gave
earlier. That's when I decided it was getting too hacky, and it made
sense to reach out and make sure that I was running the tests the
right way, etc.

Of course, if you'd like more detail on anything, please let me know.  :)

Thanks!
Eli

On Wed, May 18, 2016 at 8:42 AM, Matti Picus <matti.pi...@gmail.com> wrote:
> On 18/05/16 08:43, Eli Stevens (Gmail) wrote:
>>
>> The following works on cpython, but fails on pypy:
>>
>>      import numpy as np
>>      def test_writeable():
>>          a = np.zeros((2,2), np.int8)
>>>
>>>        a.flags.writeable = False
>>
>> E       TypeError: readonly attribute
>>
>> So I went and installed pypy's fork of numpy from source, and tried to
>> start poking around looking for tests, etc. to see what was going on.
>>
>> It looks like numpy/core/tests/test_multiarray.py
>> TestFlags.test_writeable is doing something similar, but when I
>> attempt to run the tests like so:
>>
>> pypy -c "import numpy; numpy.test()"
>>
>> (Is that the right way to do it?)
>>
>> ...
>
> Thanks for looking into this. It seems there are two seperate issues, the
> failure to set flag attributes and the failure to run tests.
> Could you give a few more details about how to reproduce the second problem:
> which pypy and how did you obtain it, and how you built/installed numpy into
> it? What imports did you have to change?
> You shouldn't have to change imports, but it is entirely possible that we
> have overlooked something.
> Matti
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to