【问题标题】:Heroku deployment -Unable to locate package AptfileHeroku 部署 - 无法找到包 Aptfile
【发布时间】:2021-02-05 19:27:21
【问题描述】:

我构建了一个应用程序,它使用通过 Heroku 部署的 geopackages/GDAL。所以我按照here 的描述添加了 buildpack-apt。我在我的项目目录中包含了一个 Aptfile 内容

gdal-bin

我在构建过程中收到以下错误消息:

 -----> Building on the Heroku-18 stack
-----> Geo Packages (GDAL/GEOS/PROJ) app detected
-----> Installing GDAL-2.4.0
-----> Installing GEOS-3.7.2
-----> Installing PROJ-5.2.0
-----> Apt app detected
-----> Reusing cache
-----> Updating apt caches
       Get:1 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease [104 kB]
       Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
       Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
       Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
       Get:5 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages [369 kB]
       Get:6 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1,379 kB]
       Get:7 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1,889 kB]
       Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2,309 kB]
       Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2,146 kB]
       Fetched 8,373 kB in 2s (5,003 kB/s)
       Reading package lists...
-----> Fetching .debs for Aptfile
       Reading package lists...
       Building dependency tree...
E: Unable to locate package Aptfile
 !     Push rejected, failed to compile Apt app.
 !     Push failed

我之前能够多次部署,最后一次是 6 天前。如果我恢复到部署工作的先前提交,并尝试再次部署,则会失败并出现上面显示的错误。 在我之前的成功部署中,我确实收到了一条错误消息,但构建能够继续,如下所示:

  -----> Building on the Heroku-18 stack
-----> Geo Packages (GDAL/GEOS/PROJ) app detected
-----> Installing GDAL-2.4.0
-----> Installing GEOS-3.7.2
-----> Installing PROJ-5.2.0
-----> Apt app detected
-----> Reusing cache
-----> Updating apt caches
       Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
       Hit:2 http://archive.ubuntu.com/ubuntu bionic-security InRelease
       Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
       Hit:4 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
       Reading package lists...
-----> Fetching .debs for Aptfile
       Reading package lists...
       Building dependency tree...
E: Unable to locate package Aptfile
-----> Fetching .debs for gdal-bin
       Reading package lists...
       Building dependency tree...
       The following additional packages will be installed:
         gdal-data libaec0 libarmadillo8 libarpack2 libblas3 libdap25 libdapclient6v5
         libepsilon1 libfreexl1 libfyba0 libgdal20 libgeos-3.7.1 libgeos-c1v5
         libgeotiff2 libgfortran4 libgif7 libhdf4-0-alt libhdf5-100 libkmlbase1
         libkmldom1 libkmlengine1 liblapack3 libminizip1 libnetcdf13 libnspr4 libnss3
         libodbc1 libogdi3.2 libopenjp2-7 libpoppler73 libproj12 libqhull7
         libspatialite7 libsuperlu5 libsz2 liburiparser1 libxerces-c3.2 odbcinst
         odbcinst1debian2 proj-bin proj-data
       Suggested packages:
         libgdal-grass python-gdal geotiff-bin libgeotiff-epsg libhdf4-doc
         libhdf4-alt-dev hdf4-tools libmyodbc odbc-postgresql tdsodbc unixodbc-bin
         ogdi-bin
       The following NEW packages will be installed:
         gdal-bin gdal-data libaec0 libarmadillo8 libarpack2 libblas3 libdap25
         libdapclient6v5 libepsilon1 libfreexl1 libfyba0 libgdal20 libgeos-3.7.1
         libgeos-c1v5 libgeotiff2 libgfortran4 libgif7 libhdf4-0-alt libhdf5-100
         libkmlbase1 libkmldom1 libkmlengine1 liblapack3 libminizip1 libnetcdf13
         libnspr4 libnss3 libodbc1 libogdi3.2 libopenjp2-7 libpoppler73 libproj12
         libqhull7 libspatialite7 libsuperlu5 libsz2 liburiparser1 libxerces-c3.2
         odbcinst odbcinst1debian2 proj-bin proj-data
       0 upgraded, 42 newly installed, 0 to remove and 0 not upgraded.
       Need to get 0 B/21.4 MB of archives.
       After this operation, 79.9 MB of additional disk space will be used.
       Download complete and in download only mode
-----> Installing gdal-bin_2.2.3+dfsg-2_amd64.deb
-----> Installing gdal-data_2.2.3+dfsg-2_all.deb
-----> Installing libaec0_0.3.2-2_amd64.deb
-----> Installing libarmadillo8_1%3a8.400.0+dfsg-2_amd64.deb
-----> Installing libarpack2_3.5.0+real-2_amd64.deb
-----> Installing libblas3_3.7.1-4ubuntu1_amd64.deb
-----> Installing libdap25_3.19.1-2build1_amd64.deb
-----> Installing libdapclient6v5_3.19.1-2build1_amd64.deb
-----> Installing libepsilon1_0.9.2+dfsg-2_amd64.deb
-----> Installing libfreexl1_1.0.5-1_amd64.deb
-----> Installing libfyba0_4.1.1-3_amd64.deb
-----> Installing libgdal20_2.2.3+dfsg-2_amd64.deb
-----> Installing libgeos-3.7.1_3.7.1-1~pgdg18.04+1_amd64.deb
-----> Installing libgeos-c1v5_3.7.1-1~pgdg18.04+1_amd64.deb
-----> Installing libgeotiff2_1.4.2-2build1_amd64.deb
-----> Installing libgfortran4_7.5.0-3ubuntu1~18.04_amd64.deb
-----> Installing libgif7_5.1.4-2ubuntu0.1_amd64.deb
-----> Installing libhdf4-0-alt_4.2.13-2_amd64.deb
-----> Installing libhdf5-100_1.10.0-patch1+docs-4_amd64.deb
-----> Installing libkmlbase1_1.3.0-5_amd64.deb
-----> Installing libkmldom1_1.3.0-5_amd64.deb
-----> Installing libkmlengine1_1.3.0-5_amd64.deb
-----> Installing liblapack3_3.7.1-4ubuntu1_amd64.deb
-----> Installing libminizip1_1.1-8build1_amd64.deb
-----> Installing libnetcdf13_1%3a4.6.0-2build1_amd64.deb
-----> Installing libnspr4_2%3a4.18-1ubuntu1_amd64.deb
-----> Installing libnss3_2%3a3.35-2ubuntu2.12_amd64.deb
-----> Installing libodbc1_2.3.4-1.1ubuntu3_amd64.deb
-----> Installing libogdi3.2_3.2.0+ds-2_amd64.deb
-----> Installing libopenjp2-7_2.3.0-2build0.18.04.1_amd64.deb
-----> Installing libpoppler73_0.62.0-2ubuntu2.12_amd64.deb
-----> Installing libproj12_4.9.3-2_amd64.deb
-----> Installing libqhull7_2015.2-4_amd64.deb
-----> Installing libspatialite7_4.3.0a-5build1_amd64.deb
-----> Installing libsuperlu5_5.2.1+dfsg1-3_amd64.deb
-----> Installing libsz2_0.3.2-2_amd64.deb
-----> Installing liburiparser1_0.8.4-1_amd64.deb
-----> Installing libxerces-c3.2_3.2.0+debian-2_amd64.deb
-----> Installing odbcinst1debian2_2.3.4-1.1ubuntu3_amd64.deb
-----> Installing odbcinst_2.3.4-1.1ubuntu3_amd64.deb
-----> Installing proj-bin_4.9.3-2_amd64.deb
-----> Installing proj-data_4.9.3-2_all.deb
-----> Writing profile script
-----> Rewrite package-config files
-----> Python app detected
-----> No change in requirements detected, installing from cache
-----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
-----> Installing SQLite3
-----> Installing requirements with pip
-----> Geo Packages (GDAL/GEOS/PROJ) app detected
-----> Installing GDAL-2.4.0
-----> Installing GEOS-3.7.2
-----> Installing PROJ-5.2.0
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 110.3M
-----> Launching...

我检查了 aptfile 在我的 github 存储库中,我通过它推送部署到 heroku。 我在 stackoverflow 或其他上没有发现类似的错误,知道如何解决这个问题吗?

【问题讨论】:

  • 添加 Apt 文件后,确保从正确的分支推送。我在另一个分支(包括 Aptfile)上时从 master 推送错误

标签: heroku deployment apt


【解决方案1】:

实际上,我能够找到解决方案。 我通过 heroku cli 在我的应用程序上执行了“heroku run bash”并查看了文件夹树。

“Aptfile”位于应用程序根目录中。 我把它移到了 .apt/ 目录下。

我尝试的下一个构建成功了,“E: Unable to locate package Aptfile”消失了。

【讨论】:

    【解决方案2】:

    我遵循相同的链接。我收到以下错误: django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings. 我按照以下步骤操作:

    1. https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku-community/apt.tgz 添加到我的构建包中
    2. 在我的根目录中创建了一个 Aptfile 并将 gdal-bin 添加到其中。
    3. 已部署应用程序

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-19
      • 2017-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-21
      相关资源
      最近更新 更多