Question

I get the following error seemingly every time I try to do anything involving a kd-tree. Strangely, just days ago this very code was working fine, and it is still working fine on my colleague's machine (we are using the same repo).

It seems to happen no matter what I pass in.

Can anyone offer any insights?

  File "filename.py", line 69, in methodname
    get_index = self.kd_tree.query(array_to_query)
  File "/Library/Python/2.7/site-packages/scipy-0.12.0.dev_ddd617d_20120920-py2.7-macosx-10.8-x86_64.egg/scipy/spatial/kdtree.py", line 425, in query
    for c in np.ndindex(retshape):
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/lib/index_tricks.py", line 536, in __init__
    x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/lib/stride_tricks.py", line 28, in as_strided
    return np.asarray(DummyArray(interface, base=x))
  File "/Library/Python/2.7/site-packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/core/numeric.py", line 320, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: negative dimensions are not allowed
Was it helpful?

Solution

Never found out the answer but a forced reinstall of numpy and scipy fixed the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top