简体   繁体   中英

Error No such file or directory: 'gdal-config' when pushing app to heroku

I've tried to push an app that contains geopandas to heroku and I get this error:

remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: -----> Python app detected
remote: -----> Installing python-3.9.4
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting Fiona==1.8.13.post1
remote:          Downloading Fiona-1.8.13.post1.tar.gz (1.2 MB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uxcfxwz1/fiona/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uxcfxwz1/fiona/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-flgcbl6w
remote:                 cwd: /tmp/pip-install-uxcfxwz1/fiona/
remote:            Complete output (2 lines):
remote:            Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
remote:            A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed

I've seen in this heroku post that you should add heroku's geo build pack. But if I do so, is like my app requirements.txt is no longer installed.

Here's what I get after adding heroku's geo build pack and removing BUILD_WITH_GEO_LIBRARIES like the post says you should:

remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: https://github.com/heroku/heroku-geo-buildpack.git
remote: -----> Geo Packages (GDAL/GEOS/PROJ) app detected
remote: -----> Installing GDAL-2.4.0
remote: -----> Installing GEOS-3.7.2
remote: -----> Installing PROJ-5.2.0
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 36.6M
remote: -----> Launching...
remote:        Released v5
remote:        https://rental-properties.herokuapp.com/ deployed to Heroku
remote:
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: d00d76ab85b1646d03d3adcc4e99b759cfbf4f5c
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version d00d76ab85b1646d03d3adcc4e99b759cfbf4f5c
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy... done.

He doesn't install pip requirements anymore. Can anyone help me on this?

I assume by your tags you're using python. If so, you're missing the python buildpack. Do on your gitbash or cmd:

heroku buildpacks:set heroku/python

Note that there is also a special geos heroku buildpack https://elements.heroku.com/buildpacks/heroku/heroku-geo-buildpack

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM