'Installing "libspatialindex-dev" on Jupyter

I am trying to conduct an inner spatial join using Geopandas, where both points and poly are Geodataframes.

instersection = gpd.sjoin(points, poly, how='inner')

However it is throwing up the error of: Spatial indexes require either `rtree` or `pygeos`

I am aware it is do with not having installed libspatialindex-dev (see libspatialindex and Rtree on python), but none of the sudo apt install ... method works on Jupyter.

How am I able to install it on Jupyter notebook?



Solution 1:[1]

If you are using Google Colab notebook you can find this link to be helpful:

https://colab.research.google.com/drive/1N7i9zmOwVcUzd4eHWZux4p_WTBMZHi8C

I ran the above notebook and was able to successfully install rtree.

While this may be helpful as well:

On your Jupyter cell run this:

!apt-get install -y libspatialindex-dev

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Talha Tayyab