Can't convert scidbpy array to numpy array


#1

I’ve installed scidb 15.12 that works fine with AQL. And after I installed scidbpy there seemed to be some issues. Here’s the error when I tried to convert a scidb array to numpy:

Traceback (most recent call last):
File “hello_scidbpy.py”, line 9, in
print xsdb.toarray()
File “/usr/local/lib/python2.7/dist-packages/scidbpy/scidbarray.py”, line 998, in toarray
return parse.toarray(self, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/scidbpy/parse.py”, line 352, in toarray
return func(array, compression=compression)
File “/usr/local/lib/python2.7/dist-packages/scidbpy/parse.py”, line 298, in toarray_sparse
result[att][inds] = atts[att]
IndexError: arrays used as indices must be of integer (or boolean) type

My code is super simple:

import numpy as np
from scidbpy import connect

sdb = connect(‘http://localhost:8080’)

x = np.random.random((5,4))
print x
xsdb = sdb.from_array(x)
print xsdb.toarray()


#2

solved:

should compile scidb-py from the latest source code.

“pip install scidb-py” installed the wrong version.

However, it popped up several warnings:

/usr/local/lib/python2.7/dist-packages/scidb_py-15.12.dev-py2.7.egg/scidbpy/parse.py:135: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future
/usr/local/lib/python2.7/dist-packages/scidb_py-15.12.dev-py2.7.egg/scidbpy/parse.py:133: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future


#3

@dongfangzhao

Just as a test, can you try installing from pip once again? @jrivers recently updated the package on pip – of course, the version he uploaded probably works for SciDB 15.12.


#4

I did a pip install today (Sep 4) but this problem is still there. Installing from git solve the problem, and I also see the VisibleDeprecationWarning. I am using Python 2,7 and Scidb 15.12.


#5

I’m getting this same error in the VirtualBox VM.


#6

todataframe() gives the same error


#7

it works after doing this instead:

pip install git+http://github.com/paradigm4/scidb-py.git