4

I am deploying a GIS app on heroku. I developed it in my computer and when I deploy it, rtree is missing. I am not able to install it via pip, since the pip installation is buggy, as stated by the rtree developers themselves. How can I get this dependency into heroku?

2 Answers2

2

I know this question is old, but I'd thought I'd put my solution in case anyone was still having this problem.

For me at least, the reason the pip installation of RTree 0.9.4 was failing was due to the following error:

AttributeError: /app/.heroku/python/bin/python: undefined symbol: Error_GetLastErrorNum

According to this known error with pip installation for RTree (https://github.com/Toblerity/rtree/issues/120), I figured it could be due to a problem with libspatialindex not being properly installed/configured on the heroku servers.

To solve this problem with libspatialindex, I added a buildpack to Heroku. This one worked for me: https://github.com/ihat/heroku-libspatialindex-buildpack.git

You need to still add the standard python buildpack after the libspatialindex one.

Image of Heroku Dashboard Buildpack Installation Order

This allowed RTree to install correctly for me through the automatic heroku pip installation process.

AnnaAD
  • 21
  • 2
  • This solution doesn't seem to work anymore, the buildback raises an error. The following buildpack returns a success message on running, but Rtree's installation fails: https://github.com/teddyward/libspatialindex-buildpack.git – Ricardo Sampaio Apr 16 '21 at 18:16
1

There is a Rtree library for linux (https://pypi.org/project/Rtree-linux/), which worked for me, without using any Buildpack. Just add Rtree-linux==x.x.x to your requirements.

Steffen Moritz
  • 7,277
  • 11
  • 36
  • 55
Robin Uphoff
  • 625
  • 1
  • 9
  • 19