【问题标题】:Error No such file or directory: 'gdal-config' when pushing app to heroku错误没有这样的文件或目录:将应用程序推送到heroku时出现'gdal-config'
【发布时间】:2021-04-24 20:06:27
【问题描述】:

我尝试将包含 geopandas 的应用推送到 heroku,但出现此错误:

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

我在this heroku 帖子中看到您应该添加heroku 的地理构建包。但是如果我这样做了,就像我的应用 requirements.txt 不再安装一样。

这是我在添加 heroku 的地理构建包并删除 BUILD_WITH_GEO_LIBRARIES 后得到的结果,就像帖子说的那样:

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.

他不再安装 pip 要求。谁能帮我解决这个问题?

【问题讨论】:

    标签: python heroku deployment gdal geopandas


    【解决方案1】:

    根据您的标签,我假设您使用的是 python。如果是这样,你错过了 python buildpack。在你的 gitbash 或 cmd 上执行:

    heroku buildpacks:set heroku/python
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-30
      • 2019-12-13
      • 2023-03-20
      相关资源
      最近更新 更多