New submission from Rich Wareham <[email protected]>: Using PyPy 2.3 installed via pyenv, np.load fails when trying to read data because it makes use of np.frombuffer which is None.
Setting np.frombuffer equal to np.fromstring is a workaround. Numpy instaled via pip install git+https://bitbucket.org/pypy/numpy.git. Output of python --version: $ python --version Python 2.7.6 (394146e9bb67, May 08 2014, 17:08:54) [PyPy 2.3.0 with GCC 4.6.3] IPython log: # IPython log file get_ipython().magic(u'pinfo %save') get_ipython().magic(u'quickref') get_ipython().magic(u'pinfo %logstart') import numpy as np np.load('tests/lena.npz').keys() #[Out]# ['lena'] np.load('tests/lena.npz')['lena'] repr(np.frombuffer) #[Out]# 'None' np.frombuffer = np.fromstring np.load('tests/lena.npz')['lena'] #[Out]# array([[ 0.63529414, 0.63529414, 0.63529414, ..., 0.66666669, #[Out]# 0.60784316, 0.50196081], #[Out]# [ 0.63529414, 0.63529414, 0.63529414, ..., 0.66666669, #[Out]# 0.60784316, 0.50196081], #[Out]# [ 0.63529414, 0.63529414, 0.63529414, ..., 0.66666669, #[Out]# 0.60784316, 0.50196081], #[Out]# ..., #[Out]# [ 0.16862746, 0.16862746, 0.19607843, ..., 0.40784314, #[Out]# 0.39215687, 0.38431373], #[Out]# [ 0.17254902, 0.17254902, 0.21568628, ..., 0.40784314, #[Out]# 0.41176471, 0.42352942], #[Out]# [ 0.17254902, 0.17254902, 0.21568628, ..., 0.40784314, #[Out]# 0.41176471, 0.42352942]], dtype=float32) get_ipython().magic(u'logstop') Exception and traceback: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-95e5d6d28212> in <module>() ----> 1 np.load('tests/lena.npz')['lena'] /users/rjw57/projects/dtcwt/venv-pypy/site-packages/numpy/lib/npyio.pyc in __getitem__(self, key) 248 if magic == format.MAGIC_PREFIX: 249 bytes = self.zip.open(key) --> 250 return format.read_array(bytes) 251 else: 252 return self.zip.read(key) /users/rjw57/projects/dtcwt/venv-pypy/site-packages/numpy/lib/format.pyc in read_array(fp) 466 data = _read_bytes(fp, read_size, "array data") 467 array[i:i+read_count] = numpy.frombuffer(data, dtype=dtype, --> 468 count=read_count) 469 470 if fortran_order: TypeError: 'NoneType' object is not callable ---------- messages: 6882 nosy: pypy-issue, rjw57 priority: bug status: unread title: numpy.load fails because numpy.frombuffer is None ________________________________________ PyPy bug tracker <[email protected]> <https://bugs.pypy.org/issue1766> ________________________________________ _______________________________________________ pypy-issue mailing list [email protected] https://mail.python.org/mailman/listinfo/pypy-issue
