If it also helps. I have root access. Seems like I am not the only with the problem, but a couple had this problems https://github.com/ioos/conda-recipes/pull/198 I had updated my core.py accordingly as documented in the link however I get a new error.

python setup.py build
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    import rtree
  File "/home/ricson/Rtree-0.8.2/rtree/__init__.py", line 1, in <module>
    from .index import Rtree
  File "/home/ricson/Rtree-0.8.2/rtree/index.py", line 6, in <module>
    from . import core
  File "/home/ricson/Rtree-0.8.2/rtree/core.py", line 113, in <module>
    rt = ctypes.CDLL(os.path.join(sys.prefix, 'lib', lib_name))
  File "/usr/lib64/python2.6/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libspatialindex_c.so: cannot open shared object file: No such file or directory

I do know that this is a directory issue but I did not install anything our of the ordinary. I installed libspatialindex 1.8.5 using .configure; make; make install; ldconfig; no more not less.

I am able to build and execute if I change

rt = ctypes.CDLL(os.path.join(sys.prefix, 'lib', lib_name))


rt = ctypes.CDLL(os.path.join(sys.prefix, 'local/lib', lib_name))

However, Rtree will fail 3 out of the 6 tests.


I am trying to install Rtree module on python 2.6.6 however setup.py insists that I have libspatialindex 1.6 when I have clearly just installed libspatialindex 1.8.5

Did I miss some steps? The script below as prescribe by libspatialindex owner does return 1.8.5 (https://github.com/libspatialindex/libspatialindex/wiki/1.-Getting-Started)

#include <iostream>
#include <spatialindex/capi/sidx_api.h>
using namespace std;
using namespace SpatialIndex;

    int main(int argc, char* argv[])
        char* pszVersion = SIDX_Version();
        fprintf(stdout, "libspatialindex version: %s\n", pszVersion);

However when I edited index.py in Rtree and I get version 1.6.1 when I have clearly installed 1.8.5

python ../setup.py
core.rt.SIDX_Version() 1.6.1
Traceback (most recent call last):
  File "../setup.py", line 4, in <module>
    import rtree
  File "/home/ricson/Rtree-0.8.2/rtree/__init__.py", line 1, in <module>
    from .index import Rtree
  File "/home/ricson/Rtree-0.8.2/rtree/index.py", line 39, in <module>
    raise Exception("This version of Rtree requires libspatialindex 1.7.0 or greater")
Exception: This version of Rtree requires libspatialindex 1.7.0 or greater

Let me know if this needs to be moved to serverfault. Thanks in advance.

migrated from stackoverflow.com Mar 22 '16 at 20:55

This question came from our site for professional and enthusiast programmers.

  • This should probably be moved to ServerFault. But you will need to install libspatialindex which information on doing so can be found here. It may also be in the package manager. Try sudo yum search spatial to see if it exists within the Yum repos. – Cory Shay Mar 22 '16 at 18:35
  • Thanks! will move this to serverfault. It is not in my repository. I had to download it from git and install on my own. – Ricsonc Mar 22 '16 at 18:38
  • Did you make sure to run sudo ldconfig after installing libspatialindex? Also what is the output of ldconfig -p | grep spatial? – Cory Shay Mar 22 '16 at 18:59
  • 2 new findings. I did find someone else having the same problem. I tried applying the ammendments but I now get a new error. https://github.com/ioos/conda-recipes/pull/198 Another finding is that without ammending core.py, It will take the default spatialindex library that is installed on RHEL. I went to check and there is indeed spatialindex 1.6.1 install on RHEL by default. – Ricsonc Mar 22 '16 at 19:11
  • What is the new error? You could edit your question with the new error. – Cory Shay Mar 22 '16 at 20:17

Will set this to closed for now. Settled with installing r-tree 0.6 which only needs spatialindex 1.5.0+

rtree will test 5/6 passed. My basic script work for now but will eventually need to remember that this may cause problems in the long run.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.