rtree: AttributeError: python: undefined symbol: Error_GetLastErrorNum

I’ve installed spatialindex/1.8.5 from source and I’m trying to compile rtree 0.8.2 against it. Running

python setup.py install 

tries to import rtree and fails in ctype

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import rtree
  File "/glade/scratch/ddvento/build/Rtree-0.8.2/rtree/__init__.py", line 1, in <module>
    from .index import Rtree
  File "/glade/scratch/ddvento/build/Rtree-0.8.2/rtree/index.py", line 6, in <module>
    from . import core
  File "/glade/scratch/ddvento/build/Rtree-0.8.2/rtree/core.py", line 110, in <module>
    rt.Error_GetLastErrorNum.restype = ctypes.c_int
  File "/glade/apps/opt/python/2.7.7/gnu-westmere/4.8.2/lib/python2.7/ctypes/__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "/glade/apps/opt/python/2.7.7/gnu-westmere/4.8.2/lib/python2.7/ctypes/__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: python: undefined symbol: Error_GetLastErrorNum

My plan to let rtree know about spatialindex was via the C compiler, but it failed before. How should I proceed?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

sudo apt install libspatialindex-dev python-rtree solved my issue.

hey, I am getting this same error with version Rtree-0.9.3. Please help.

sudo apt install libspatialindex-dev python-rtree solved my issue.

Thanks, I needed to use python3-rtree instead.

sudo apt install libspatialindex-dev python-rtree solved my issue.

Thanks. This fixed it for me as well. However, I only needed libspatialindex-dev. With that, the pip version of rtree was able to install, so you don’t need the older outdated system package.

Yes I am getting it too, but I had not reported yet because I was stuck in running additional tests with additional settings. I believe the issue is the one that “solved” https://github.com/Toblerity/rtree/issues/120

Don’t use pip to install rtree @davidedelvento, use conda so that the rtree package’s dependencies are found and installed properly.