Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rtree and a missing libspatialindex_c library file #45

Closed
stevenbeeckman opened this issue Apr 13, 2017 · 10 comments
Closed

Rtree and a missing libspatialindex_c library file #45

stevenbeeckman opened this issue Apr 13, 2017 · 10 comments
Labels

Comments

@stevenbeeckman
Copy link

@stevenbeeckman stevenbeeckman commented Apr 13, 2017

Problem description (what did you do, what did you expect to happen, and what actually happened)

Importing osmnx on the Python REPL indicates a missing libspatialindex_c library file.

What operating system, architecture, Python version, and OSMnx version are you using?

Mac OS X 10.10.5 Yosemite, Python 2.7.12. osmnx 0.4.1

Code that reproduces the issue

>> import osmnx as ox
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/osmnx/__init__.py", line 8, in <module>
    from .core import *
  File "/usr/local/lib/python2.7/site-packages/osmnx/core.py", line 20, in <module>
    import geopandas as gpd
  File "/usr/local/lib/python2.7/site-packages/geopandas/__init__.py", line 1, in <module>
    from geopandas.geoseries import GeoSeries
  File "/usr/local/lib/python2.7/site-packages/geopandas/geoseries.py", line 16, in <module>
    from geopandas.base import GeoPandasBase
  File "/usr/local/lib/python2.7/site-packages/geopandas/base.py", line 15, in <module>
    from rtree.core import RTreeError
  File "/usr/local/lib/python2.7/site-packages/rtree/__init__.py", line 1, in <module>
    from .index import Rtree
  File "/usr/local/lib/python2.7/site-packages/rtree/index.py", line 5, in <module>
    from . import core
  File "/usr/local/lib/python2.7/site-packages/rtree/core.py", line 125, in <module>
    raise OSError("Could not find libspatialindex_c library file")
OSError: Could not find libspatialindex_c library file

The solution was described in this blogpost: brew install spatialindex.

This issue may be closed as I created this issue purely for documentation purposes.

@gboeing

This comment has been minimized.

Copy link
Owner

@gboeing gboeing commented Apr 14, 2017

Thanks.

libspatialindex is also listed as a dependency of the rtree package in its installation instructions. You can also install everything for OSMnx in one fell swoop with conda.

@gboeing gboeing closed this Apr 14, 2017
@solomonvimal

This comment has been minimized.

Copy link

@solomonvimal solomonvimal commented Jul 2, 2017

Installing OSMnx solved this issue for me! Thanks @gboeing!

@1papaya

This comment has been minimized.

Copy link

@1papaya 1papaya commented Oct 9, 2018

On Ubuntu 18.04 it worked to install rtree from apt instead of pip, as follows:
sudo apt install python3-rtree

@hanleybrand

This comment has been minimized.

Copy link

@hanleybrand hanleybrand commented Oct 17, 2018

On MacOS you can brew install spatialindex to fix this problem (for people that don't have conda installed)

@huesmiles49

This comment has been minimized.

Copy link

@huesmiles49 huesmiles49 commented Dec 24, 2018

@hanleybrand thank you! installing spatialindex fixed the problem

@anderl80

This comment has been minimized.

Copy link

@anderl80 anderl80 commented May 27, 2019

Unfortunately I have the same issue when using a Google Colab env. I can only use pip install osmnx and so libspatialindex is missing.

mflaxman10 added a commit to geodesign/ubiquitous-octo-parakeet that referenced this issue Jun 12, 2019
trying to fix lack of spatial index needed by osmnx

gboeing/osmnx#45
@ratnanil

This comment has been minimized.

Copy link

@ratnanil ratnanil commented Nov 6, 2019

Unfortunately I have the same issue when using a Google Colab env. I can only use pip install osmnx and so libspatialindex is missing.

Same here when using https://mybinder.org

@AtelierLibre

This comment has been minimized.

Copy link
Contributor

@AtelierLibre AtelierLibre commented Nov 6, 2019

I'm not familiar with mybinder.org but, incase it's helpful, with Colab using apt instead of pip to install rtree will bring the c library with it:

# apt to install c libraries as well
!apt install python3-rtree
@ratnanil

This comment has been minimized.

Copy link

@ratnanil ratnanil commented Nov 6, 2019

@AtelierLibre: Thank you for the tipp! I was just able to use apt in mybinder with these instructions: Add a file named apt.txt to the repo containing just a single line:

libspatialindex-dev
@AtelierLibre

This comment has been minimized.

Copy link
Contributor

@AtelierLibre AtelierLibre commented Nov 6, 2019

That's great, glad it was helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.