why can't I import geopandas? why can't I import geopandas? python python

why can't I import geopandas?


I had the same issue while working in Linux Subsystem at Windows 10 (speaking about this). What helped was installing the version for developers using apt. Namely:

sudo apt install libspatialindex-dev did the job.

I did not need to work with make.

edit: Nice to see my answer has been upvoted so many times; in the time of writing it, however, this was not the most popular answer and it was preceeded by the other answers that suggested using make. This is why I am referring to this command; and I think the other answers are worth reading anyway.


If you are using MacOS, it's as simple as follow:

brew install spatialindexpip install rtree

If you are working on linux environment you have to build this from source:

  1. Install spatialindex

    curl -L https://github.com/libspatialindex/libspatialindex/archive/1.8.5.tar.gz | tar xzcd libspatialindex-1.8.5/./autogen.sh./configuremakesudo make installsudo ldconfig
  1. install rtree: pip install rtree


Linux installation steps for Docker users:

RUN apt-get updateRUN apt-get install -y --fix-missing curl autoconf libtool automakeRUN curl -L https://github.com/libspatialindex/libspatialindex/archive/1.8.5.tar.gz | tar -xzRUN cd libspatialindex-1.8.5 && ./autogen.sh && ./configure && make && make install && ldconfig