heroku / heroku-geo-buildpack

37 stars 26 forks source link

heroku-buildpack-python overwrites GEOS and GDAL exports #7

Closed marianstefi20 closed 4 years ago

marianstefi20 commented 4 years ago

Hi. I had troubles using heroku-geo-buildpack along with heroku-buildpack-python. My Django application was complaining it couldn't find the GDAL and GEOS libraries. Looking into heroku-geo-buildpack I can see this:

echo 'export GDAL_LIBRARY_PATH="$HOME/.heroku-geo-buildpack/vendor/lib/libgdal.so"' >> $PROFILE_PATH
echo 'export GEOS_LIBRARY_PATH="$HOME/.heroku-geo-buildpack/vendor/lib/libgeos_c.so"' >> $PROFILE_PATH

And in https://github.com/heroku/heroku-buildpack-python/blob/master/bin/steps/geo-libs I can see this:

set_env GDAL_LIBRARY_PATH "/app/.heroku/vendor/lib/libgdal.so"
set_env GEOS_LIBRARY_PATH "/app/.heroku/vendor/lib/libgeos_c.so"

Because heroku-geo-buildpack is the first one in the list, I believe heroku-buildpack-python will actually overwrite the paths set by the first one or not use them properly.

KevinBrolly commented 4 years ago

Hi @marianstefi20 - the heroku-buildpack-python will only add the GEOS/GDAL exports if BUILD_WITH_GEO_LIBRARIES is true - https://github.com/heroku/heroku-buildpack-python/blob/master/bin/steps/geo-libs#L24

This library was created as an alternative way of enabling similar functionality since BUILD_WITH_GEO_LIBRARIES is now deprecated - https://devcenter.heroku.com/changelog-items/1759 & https://help.heroku.com/D5INLB1A/python-s-build_with_geo_libraries-legacy-feature-is-now-deprecated

So there should be no conflict between the two buildpacks as long as you have not set BUILD_WITH_GEO_LIBRARIES when using the heroku-buildpack-python.