I built an app which uses geopackages/GDAL deployed via Heroku. So I added the buildpack-apt as described here. I included an Aptfile in the directory of my project with content
gdal-bin
I get the following error message during build:
-----> 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
I was able to deploy numerous times before, the last time 6 days ago. If I revert to my previous commit for which the deployment worked, and try to deploy again, it fails with the error shown above.
In my previous successful deployments, I did get an error message but the build was able to continue, as shown below:
-----> 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...
I checked that the aptfile is on my github repo through which I push to deploy to heroku.
I’m not finding similar errors on stackoverflow or others, any idea how to fix this?
2
Answers
Actually I was able to find a solution. I did "heroku run bash" on my app via the heroku cli and looked at the folder tree.
"Aptfile" was in the root app directory. I moved it to the .apt/ directory.
The next build I attempted was successful, and the "E: Unable to locate package Aptfile" is gone.
I followes the same link. I am getting the following error:
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.
I followed these steps: