0

My question is about a Pypy error. Totay I intended to start using pypy. However when I run my former python code it gave me a strange error message. Here is my code:

import numpy as np

k = np.load('alldata.npy')

print k.shape

when I use python2 ./p.py it gives me;

(942962, 64) however when I run my code with pypy ./p.py it gives me this:

Traceback (most recent call last):
  File "./p.py", line 5, in <module>
    k = np.load('bA1024.npy')
  File "/usr/local/lib/pypy2.7/dist-packages/numpy/lib/npyio.py",    line406, in load
    pickle_kwargs=pickle_kwargs)
  File "/usr/local/lib/pypy2.7/dist-packages/numpy/lib/format.py", line 649, in read_array
    array = numpy.fromfile(fp, dtype=dtype, count=count)
  File "/usr/local/lib/pypy2.7/dist-  packages/numpy/core/multiarray.py", line 83, in tmp
    raise NotImplementedError("%s not implemented yet" % func)
NotImplementedError: fromfile not implemented yet
A Ef
  • 13
  • 2
  • 8
  • Do you use np.save() to create alldata.npy? Can you try to use k.dump("alldata.npy") instead? – user2393256 Aug 16 '16 at 09:35
  • It means exactly what it says: the particular functionality you're trying to execute *is not implemented yet*. It's supposed to be there, but nobody has gotten around to actually writing it yet. – Why that is in particular with this particular library/method/Python version is the real question. – deceze Aug 16 '16 at 09:37
  • It worked yes. But why? – A Ef Aug 16 '16 at 09:39
  • deceze, When I used np.dump() to save my array into a file it worked. In my opinion it's because np.save() uses .npy files to store data but np.dump() doesn't. So np.load() method can work with np.dump() – A Ef Aug 16 '16 at 09:42
  • Yes, the function you're directly calling (`np.load`) works; but the particular sub-module which loads the .npy format apparently doesn't. If it works on a different version of Python but not on PyPy, there's an unsolved question there. – deceze Aug 16 '16 at 09:46
  • Yeah you're right. – A Ef Aug 16 '16 at 09:56

0 Answers0