FS#32094 - [python2-numpy] ndindex and nditer bug - fixed upstream

Attached to Project: Arch Linux
Opened by Daan van Rossum (drrossum) - Friday, 19 October 2012, 17:44 GMT
Last edited by Jan de Groot (JGC) - Wednesday, 13 March 2013, 02:09 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Jan de Groot (JGC)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
This Numpy version 1.7.0b2 seems to have a bug that causes scipy.interpolate to fail:

--
File "/usr/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 835, in spleval
res[sl] = _fitpack._bspleval(xx,xj,cvals[sl],k,deriv)
IndexError: too many indices
--

A google search reveals that this bug was fixed upstream:
http://mail.scipy.org/pipermail/scipy-user/2012-September/033254.html
https://github.com/numpy/numpy/pull/445

I can't recompile version 1.6.2 from ABS with the recent python updates, so I'll pull from git until a new version is released.
This task depends upon

Closed by  Jan de Groot (JGC)
Wednesday, 13 March 2013, 02:09 GMT
Reason for closing:  Fixed
Comment by Daan van Rossum (drrossum) - Friday, 19 October 2012, 17:53 GMT
Ouch, not even the git pull works. It's a different error now, but it's still fails within scipy.interpolate:
--
File "/usr/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 829, in spleval
for index in np.ndindex(*sh):
File "/usr/lib/python2.7/site-packages/numpy/lib/index_tricks.py", line 536, in __init__
x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
File "/usr/lib/python2.7/site-packages/numpy/lib/stride_tricks.py", line 28, in as_strided
return np.asarray(DummyArray(interface, base=x))
File "/usr/lib/python2.7/site-packages/numpy/core/numeric.py", line 324, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: __array_interface__ shape must be at least size 1
--
Perhaps this is a scipy bug after all... I'll try to recompile scipy and see if that solves the issue.
Comment by Daan van Rossum (drrossum) - Friday, 19 October 2012, 18:25 GMT
Nope, recompiling scipy 0.11.0-2 with numpy-git doesn't solve it either. Next step: scipy git pull...
Comment by Daan van Rossum (drrossum) - Friday, 19 October 2012, 19:48 GMT
No, fresh scipy git pull doesn't work either.
So I will have to go back and get numpy 1.6.2 to compile...

SO THIS IS NOT YET FIXED UPSTREAM
Comment by Daan van Rossum (drrossum) - Friday, 19 October 2012, 21:39 GMT
I recompiled my python2 stack with numpy 1.6.2 and now scipy.interpolate works fine again.
The problem with compiling 1.6.2 occured for python3.3. Who cares...
Comment by Liu Yuyang (reverland) - Saturday, 03 November 2012, 00:25 GMT
recompiled scipy in git,the problem reproduced

`ValueError: __array_interface__ shape must be at least size 1`

a google search lead me here:

https://github.com/numpy/numpy/pull/444

It said that:
"But without the shape information, it still gives the error:
ValueError: Missing __array_interface__ shape"

I don't really understand it,It looks like it's still a problem.
Comment by Daan van Rossum (drrossum) - Saturday, 10 November 2012, 03:20 GMT
Today's git pull still shows this error:
"ValueError: __array_interface__ shape must be at least size 1"

I'll stick to numpy 1.6.2 until the bug is fixed upstream.

The new matplotlib 1.2.0 package now does not work out of the box. In order to get consistency you have to recompile the mpl 1.2.0 on your own python2 stack.
Comment by Daan van Rossum (drrossum) - Tuesday, 20 November 2012, 17:50 GMT
It's still broken upstream.

I attached a patch for scipy's interpolate.py. It works around numpy ndindex no longer allowing empty tuple expansion *().

Apply the patch like this:
patch /usr/lib/python2.7/site-packages/scipy/interpolate/interpolate.py ~/patch
Comment by Daan van Rossum (drrossum) - Tuesday, 20 November 2012, 18:08 GMT
The "python-scipy-git" package from AUR now works with the current python2-numpy package from the official repositories.

Loading...