rtree: Build fails on OS X

Building rtree on OS X either from the current release or from master results in a failure:

$ pip install git+git://github.com/Toblerity/rtree.git
Downloading/unpacking git+git://github.com/Toblerity/rtree.git
  Cloning git://github.com/Toblerity/rtree.git to /var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build
  Running setup.py (path:/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/setup.py) egg_info for package from git+git://github.com/Toblerity/rtree.git
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/setup.py", line 4, in <module>
        import rtree
      File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/__init__.py", line 1, in <module>
        from .index import Rtree
      File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/index.py", line 6, in <module>
        from . import core
      File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/core.py", line 110, in <module>
        rt.Error_GetLastErrorNum.restype = ctypes.c_int
      File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ctypes/__init__.py", line 364, in __getattr__
        func = self.__getitem__(name)
      File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ctypes/__init__.py", line 369, in __getitem__
        func = self._FuncPtr((name_or_ordinal, self))
    AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/setup.py", line 4, in <module>

    import rtree

  File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/__init__.py", line 1, in <module>

    from .index import Rtree

  File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/index.py", line 6, in <module>

    from . import core

  File "/private/var/folders/z_/kgsm76k94s7_jhnkfydfnd380000gn/T/pip-p4_3c96t-build/rtree/core.py", line 110, in <module>

    rt.Error_GetLastErrorNum.restype = ctypes.c_int

  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ctypes/__init__.py", line 364, in __getattr__

    func = self.__getitem__(name)

  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ctypes/__init__.py", line 369, in __getitem__

    func = self._FuncPtr((name_or_ordinal, self))

AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found

Running Python 3.4.2 on OS X 10.10.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Even though this is closed, i landed here, but found the best solution in a different issue, not #74, the solution was simply brew install spatialindex (https://github.com/gboeing/osmnx/issues/3)

Surprisingly the brew install spatialindex seems to be not the solution. (anymore?) The error persisted.

brew install spatialindex Warning: spatialindex 1.9.3 is already installed and up-to-date

pip3 install rtree

Collecting rtree

Using cached Rtree-0.9.4.tar.gz (62 kB)

ERROR: Command errored out with exit status 1:

 command: /usr/local/opt/python/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/setup.py'"'"'; __file__='"'"'/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/pip-egg-info

     cwd: /private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/

Complete output (15 lines):

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/setup.py", line 3, in <module>

    import rtree

  File "/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/rtree/__init__.py", line 1, in <module>

    from .index import Rtree

  File "/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/rtree/index.py", line 6, in <module>

    from . import core

  File "/private/var/folders/8s/8cfgscj15y59mpdc57mvqm940000gs/T/pip-install-8dt_zlf2/rtree/rtree/core.py", line 143, in <module>

    rt.Error_GetLastErrorNum.restype = ctypes.c_int

  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__

    func = self.__getitem__(name)

  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__

    func = self._FuncPtr((name_or_ordinal, self))

AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found

----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

As it concerns my problem I have the solution:

  1. Install spatialindex with MacPorts: sudo port install spatialindex
  2. Setting the Library Path: export DYLD_LIBRARY_PATH=“/opt/local/lib” 2a) or even better: export DYLD_FALLBACK_LIBRARY_PATH=“/opt/local/lib”
  3. Install Rtree with pip: pip install Rtree
  4. For permanent use you have also to add the “DYLD_LIBRARY_PATH” or “DYLD_FALLBACK_LIBRARY_PATH” to the file “.bash_profile”

Actually, I want to correct my comment.

Python 3.7.7 + brew install spatialindex works perfectly.