[Numpy-discussion] ValueError for numpy when importing KDTree from scipy.spatial

josef.pktd@gmai... josef.pktd@gmai...
Sat Dec 19 00:02:40 CST 2009


On Sat, Dec 19, 2009 at 12:42 AM, Howard Chong <hgchong@berkeley.edu> wrote:
> I'm getting an odd behavior when I try to load KDTree. In the interactive
> interpreter: the first time I try to load it, it gives me an error. Second
> time works fine. When trying to run from command line, same error.
> To reproduce, just type the 4 commands below. If people can't reproduce it,
> I might do a re-install.
>
> Here's my session.
> *** Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
> (Intel)] on win32. ***
>>>> from scipy.spatial import KDTree
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
>   File "C:\Python26\lib\site-packages\scipy\spatial\__init__.py", line 7, in
> <module>
>     from ckdtree import *
>   File "numpy.pxd", line 30, in scipy.spatial.ckdtree
> (scipy\spatial\ckdtree.c:6087)
> ValueError: numpy.dtype does not appear to be the correct type object
>>>> KDTree
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
> NameError: name 'KDTree' is not defined
>>>> from scipy.spatial import KDTree
>>>> KDTree
> <class 'scipy.spatial.kdtree.KDTree'>
>>>>

No problem here.

What are your numpy/scipy versions?
Do you have scipy compiled against the numpy that you are using?

If you use numpy 1.4.0rc1 with scipy 0.7.1, then it might be the
cython incompatibility problem.

Josef

> --
> Howard Chong
> Dept. of Agricultural and Resource Economics and Energy Institute @ Haas
> Business School
> UC Berkeley
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


More information about the NumPy-Discussion mailing list