Question

buildpack-apt not working

Hello everyone.

Im trying to setup a DO apps deployment where I need to install some deb packages library to be used by pip isntall.

I have followed the https://docs.digitalocean.com/products/app-platform/reference/buildpacks/aptfile/ https://github.com/digitalocean/buildpack-apt

and I can see on the logs of the application that the packages are installed correctly, however, the build stage cant find the packages/library.

I have ran the build process locally (https://docs.digitalocean.com/products/app-platform/how-to/build-locally/) and I can confirm that the packages on the apt stage are installed correct, but when it start the build stage, all the apt stuff are missing.

Dont suppose that aptfile buildpack allow to “Install system dependencies from an Aptfile” to be used on the build stage ??

Attentive to any comment.




    ╭──────────── buildpack detection ───────────╼
    │ › using Ubuntu 22.04 stack
    │ Detected the following buildpacks suitable to build your app:
    │
    │ digitalocean/apt               v0.0.1 (Apt)
    │ digitalocean/python-appdetect  v0.0.3
    │ heroku/python                  v3.235.4 (Python)
    │ digitalocean/procfile          v0.0.4 (Procfile)
    │ digitalocean/custom            v0.1.2 (Custom Build Command)
    │
    │ For documentation on the buildpacks used to build your app, please see:
    │
    │ Python v3.235.4 https://do.co/apps-buildpack-python
    ╰─────────────────────────────────────────────╼

    ╭──────────── app build ───────────╼
    │ => Installing packages in Aptfile
    │ => Updating apt caches
    │ Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
    │ Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
    │ Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
    │ Get:4 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1889 kB]
    │ Get:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
    │ Get:6 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
    │ Get:7 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1074 kB]
    │ Get:8 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.6 kB]
    │ Get:9 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1517 kB]
    │ Get:10 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
    │ Get:11 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
    │ Get:12 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
    │ Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1927 kB]
    │ Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1796 kB]
    │ Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1346 kB]
    │ Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [50.4 kB]
    │ Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [28.1 kB]
    │ Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [50.4 kB]
    │ Fetched 30.0 MB in 37s (815 kB/s)
    │ Reading package lists...
    │ => Fetching dependencies for libgdal-dev
    │ Reading package lists...
    │ Building dependency tree...
    │ The following additional packages will be installed:
    │ default-libmysqlclient-dev gdal-data hdf5-helpers libaec-dev libaec0
    │ libaom-dev libarmadillo-dev libarmadillo10 libarpack2 libarpack2-dev
    │ libblas-dev libblas3 libblosc-dev libblosc1 libboost-dev libboost1.74-dev
    │ libcfitsio-dev libcfitsio-doc libcfitsio9 libcharls-dev libcharls2
    │ libdav1d-dev libde265-0 libde265-dev libfreexl-dev libfreexl1 libfyba-dev
    │ libfyba0 libgdal30 libgeos-c1v5 libgeos-dev libgeos3.10.2 libgeotiff-dev
    │ libgeotiff5 libgfortran5 libgif-dev libgif7 libhdf4-0-alt libhdf4-alt-dev
    │ libhdf5-103-1 libhdf5-cpp-103-1 libhdf5-dev libhdf5-fortran-102
    │ libhdf5-hl-100 libhdf5-hl-cpp-100 libhdf5-hl-fortran-100 libheif-dev
    │ libjson-c-dev libkml-dev libkmlbase1 libkmlconvenience1 libkmldom1
    │ libkmlengine1 libkmlregionator1 libkmlxsd1 liblapack-dev liblapack3
    │ libminizip-dev libminizip1 libnetcdf-dev libnetcdf19 libnspr4 libnss3
    │ libodbc2 libodbccr2 libodbcinst2 libogdi-dev libogdi4.1 libpoppler-dev
    │ libpoppler-private-dev libpoppler118 libproj-dev libproj22 libqhull-dev
    │ libqhull-r8.0 libqhull8.0 libqhullcpp8.0 librttopo-dev librttopo1
    │ libsnappy1v5 libspatialite-dev libspatialite7 libsuperlu-dev libsuperlu5
    │ libsz2 liburiparser-dev liburiparser1 libwebp-dev libx265-dev
    │ libxerces-c-dev libxerces-c3.2 proj-bin proj-data unixodbc-common
    │ unixodbc-dev
    │ Suggested packages:
    │ libitpp-dev liblapack-doc libboost-doc libboost1.74-doc
    │ libboost-atomic1.74-dev libboost-chrono1.74-dev libboost-container1.74-dev
    │ libboost-context1.74-dev libboost-contract1.74-dev
    │ libboost-coroutine1.74-dev libboost-date-time1.74-dev
    │ libboost-exception1.74-dev libboost-fiber1.74-dev
    │ libboost-filesystem1.74-dev libboost-graph1.74-dev
    │ libboost-graph-parallel1.74-dev libboost-iostreams1.74-dev
    │ libboost-locale1.74-dev libboost-log1.74-dev libboost-math1.74-dev
    │ libboost-mpi1.74-dev libboost-mpi-python1.74-dev libboost-numpy1.74-dev
    │ libboost-program-options1.74-dev libboost-python1.74-dev
    │ libboost-random1.74-dev libboost-regex1.74-dev
    │ libboost-serialization1.74-dev libboost-stacktrace1.74-dev
    │ libboost-system1.74-dev libboost-test1.74-dev libboost-thread1.74-dev
    │ libboost-timer1.74-dev libboost-type-erasure1.74-dev libboost-wave1.74-dev
    │ libboost1.74-tools-dev libmpfrc++-dev libntl-dev libboost-nowide1.74-dev
    │ libgdal-doc libgeotiff-epsg geotiff-bin gdal-bin libhdf4-doc hdf4-tools
    │ libhdf5-doc netcdf-bin netcdf-doc odbc-postgresql tdsodbc ogdi-bin
    │ libsuperlu-doc libx265-doc libxerces-c-doc
    │ The following NEW packages will be installed:
    │ default-libmysqlclient-dev gdal-data hdf5-helpers libaec-dev libaec0
    │ libaom-dev libarmadillo-dev libarmadillo10 libarpack2 libarpack2-dev
    │ libblas-dev libblas3 libblosc-dev libblosc1 libboost-dev libboost1.74-dev
    │ libcfitsio-dev libcfitsio-doc libcfitsio9 libcharls-dev libcharls2
    │ libdav1d-dev libde265-dev libfreexl-dev libfreexl1 libfyba-dev libfyba0
    │ libgdal-dev libgdal30 libgeos-c1v5 libgeos-dev libgeos3.10.2 libgeotiff-dev
    │ libgeotiff5 libgfortran5 libgif-dev libgif7 libhdf4-0-alt libhdf4-alt-dev
    │ libhdf5-103-1 libhdf5-cpp-103-1 libhdf5-dev libhdf5-fortran-102
    │ libhdf5-hl-100 libhdf5-hl-cpp-100 libhdf5-hl-fortran-100 libheif-dev
    │ libjson-c-dev libkml-dev libkmlbase1 libkmlconvenience1 libkmldom1
    │ libkmlengine1 libkmlregionator1 libkmlxsd1 liblapack-dev liblapack3
    │ libminizip-dev libminizip1 libnetcdf-dev libnetcdf19 libnspr4 libnss3
    │ libodbc2 libodbccr2 libodbcinst2 libogdi-dev libogdi4.1 libpoppler-dev
    │ libpoppler-private-dev libpoppler118 libproj-dev libproj22 libqhull-dev
    │ libqhull-r8.0 libqhull8.0 libqhullcpp8.0 librttopo-dev librttopo1
    │ libsnappy1v5 libspatialite-dev libspatialite7 libsuperlu-dev libsuperlu5
    │ libsz2 liburiparser-dev liburiparser1 libwebp-dev libx265-dev
    │ libxerces-c-dev libxerces-c3.2 proj-bin proj-data unixodbc-common
    │ unixodbc-dev
    │ The following packages will be upgraded:
    │ libde265-0
    │ 1 upgraded, 95 newly installed, 0 to remove and 114 not upgraded.
    │ Need to get 78.4 MB of archives.
    │ After this operation, 453 MB of additional disk space will be used.
    │ Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 default-libmysqlclient-dev amd64 1.0.8 [3586 B]
[...]
    │ Get:96 http://archive.ubuntu.com/ubuntu jammy/universe amd64 proj-bin amd64 8.2.1-1 [154 kB]
    │ Fetched 78.4 MB in 1min 19s (987 kB/s)
    │ Download complete and in download only mode
    │ => Fetching dependencies for gdal-bin
    │ Reading package lists...
    │ Building dependency tree...
    │ The following additional packages will be installed:
    │ gdal-data libaec0 libarmadillo10 libarpack2 libblas3 libblosc1 libcfitsio9
    │ libcharls2 libfreexl1 libfyba0 libgdal30 libgeos-c1v5 libgeos3.10.2
    │ libgeotiff5 libgfortran5 libgif7 libhdf4-0-alt libhdf5-103-1 libhdf5-hl-100
    │ libkmlbase1 libkmldom1 libkmlengine1 liblapack3 libminizip1 libnetcdf19
    │ libnspr4 libnss3 libodbc2 libodbcinst2 libogdi4.1 libpoppler118 libproj22
    │ libqhull-r8.0 librttopo1 libsnappy1v5 libspatialite7 libsuperlu5 libsz2
    │ liburiparser1 libxerces-c3.2 proj-bin proj-data python3-gdal python3-numpy
    │ unixodbc-common
    │ Suggested packages:
    │ libgdal-grass geotiff-bin libgeotiff-epsg libhdf4-doc libhdf4-alt-dev
    │ hdf4-tools odbc-postgresql tdsodbc ogdi-bin gfortran python-numpy-doc
    │ python3-dev python3-pytest
    │ The following NEW packages will be installed:
    │ gdal-bin gdal-data libaec0 libarmadillo10 libarpack2 libblas3 libblosc1
    │ libcfitsio9 libcharls2 libfreexl1 libfyba0 libgdal30 libgeos-c1v5
    │ libgeos3.10.2 libgeotiff5 libgfortran5 libgif7 libhdf4-0-alt libhdf5-103-1
    │ libhdf5-hl-100 libkmlbase1 libkmldom1 libkmlengine1 liblapack3 libminizip1
    │ libnetcdf19 libnspr4 libnss3 libodbc2 libodbcinst2 libogdi4.1 libpoppler118
    │ libproj22 libqhull-r8.0 librttopo1 libsnappy1v5 libspatialite7 libsuperlu5
    │ libsz2 liburiparser1 libxerces-c3.2 proj-bin proj-data python3-gdal
    │ python3-numpy unixodbc-common
    │ 0 upgraded, 46 newly installed, 0 to remove and 115 not upgraded.
    │ Need to get 4381 kB/38.1 MB of archives.
    │ After this operation, 129 MB of additional disk space will be used.
    │ Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-numpy amd64 1:1.21.5-1ubuntu22.04.1 [3467 kB]
    │ Get:2 http://archive.ubuntu.com/ubuntu jammy/universe amd64 python3-gdal amd64 3.4.1+dfsg-1build4 [673 kB]
    │ Get:3 http://archive.ubuntu.com/ubuntu jammy/universe amd64 gdal-bin amd64 3.4.1+dfsg-1build4 [241 kB]
    │ Fetched 4381 kB in 4s (1008 kB/s)
    │ Download complete and in download only mode
    │ => Fetching dependencies for libblas3
    │ Reading package lists...
    │ Building dependency tree...
    │ The following NEW packages will be installed:
    │ libblas3
    │ 0 upgraded, 1 newly installed, 0 to remove and 115 not upgraded.
    │ Need to get 0 B/228 kB of archives.
    │ After this operation, 712 kB of additional disk space will be used.
    │ Download complete and in download only mode
    │ => Fetching dependencies for libblas-dev
    │ Reading package lists...
    │ Building dependency tree...
    │ The following additional packages will be installed:
    │ libblas3
    │ Suggested packages:
    │ liblapack-doc
    │ The following NEW packages will be installed:
    │ libblas-dev libblas3
    │ 0 upgraded, 2 newly installed, 0 to remove and 115 not upgraded.
    │ Need to get 0 B/392 kB of archives.
    │ After this operation, 1796 kB of additional disk space will be used.
    │ Download complete and in download only mode
    │ => Installing apt packages with dpkg
    │ default-libmysqlclient-dev_1.0.8_amd64.deb
    │ gdal-bin_3.4.1+dfsg-1build4_amd64.deb
    │ gdal-data_3.4.1+dfsg-1build4_all.deb
    │ hdf5-helpers_1.10.7+repack-4ubuntu2_amd64.deb
    │ libaec-dev_1.0.6-1_amd64.deb
    │ libaec0_1.0.6-1_amd64.deb
    │ libaom-dev_3.3.0-1_amd64.deb
    │ libarmadillo-dev_1%3a10.8.2+dfsg-1_amd64.deb
    │ libarmadillo10_1%3a10.8.2+dfsg-1_amd64.deb
    │ libarpack2-dev_3.8.0-1_amd64.deb
    │ libarpack2_3.8.0-1_amd64.deb
    │ libblas-dev_3.10.0-2ubuntu1_amd64.deb
    │ libblas3_3.10.0-2ubuntu1_amd64.deb
    │ libblosc-dev_1.21.1+ds2-2_amd64.deb
    │ libblosc1_1.21.1+ds2-2_amd64.deb
    │ libboost-dev_1.74.0.3ubuntu7_amd64.deb
    │ libboost1.74-dev_1.74.0-14ubuntu3_amd64.deb
    │ libcfitsio-dev_4.0.0-1_amd64.deb
    │ libcfitsio-doc_4.0.0-1_all.deb
    │ libcfitsio9_4.0.0-1_amd64.deb
    │ libcharls-dev_2.3.4-1_amd64.deb
    │ libcharls2_2.3.4-1_amd64.deb
    │ libdav1d-dev_0.9.2-1_amd64.deb
    │ libde265-0_1.0.8-1ubuntu0.2_amd64.deb
    │ libde265-dev_1.0.8-1ubuntu0.2_amd64.deb
    │ libfreexl-dev_1.0.6-1_amd64.deb
    │ libfreexl1_1.0.6-1_amd64.deb
    │ libfyba-dev_4.1.1-7_amd64.deb
    │ libfyba0_4.1.1-7_amd64.deb
    │ libgdal-dev_3.4.1+dfsg-1build4_amd64.deb
    │ libgdal30_3.4.1+dfsg-1build4_amd64.deb
[...]
    │ unixodbc-dev_2.3.9-5_amd64.deb
    │ LD_LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
    │ LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
    │ INCLUDE_PATH=/layers/digitalocean_apt/apt/usr/include:/layers/digitalocean_apt/apt/usr/include/x86_64-linux-gnu
    │ CPATH=$INCLUDE_PATH
    │ PKG_CONFIG_PATH=/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/pkgconfig
    │ => Installed 4 packages in 127s
    │ -----> No Python version was specified. Using the buildpack default: python-3.11.5
    │ To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
    │ -----> Installing python-3.11.5
    │ -----> Installing pip 23.2.1, setuptools 68.0.0 and wheel 0.41.0
    │ -----> Installing SQLite3
    │ -----> Installing requirements with pip
    │ Collecting GDAL==3.4.1 (from -r requirements.txt (line 3))
    │ Downloading GDAL-3.4.1.tar.gz (755 kB)
    │ Preparing metadata (setup.py): started
    │ Preparing metadata (setup.py): finished with status 'done'
    │ Building wheels for collected packages: GDAL
    │ Building wheel for GDAL (setup.py): started
    │ Building wheel for GDAL (setup.py): finished with status 'error'
    │ error: subprocess-exited-with-error
    │
    │ × python setup.py bdist_wheel did not run successfully.
    │ │ exit code: 1
    │ ╰─> [146 lines of output]
    │ WARNING: numpy not available! Array support will not be enabled
    │ running bdist_wheel
    │ running build
    │ running build_py
    │ creating build
    │ creating build/lib.linux-x86_64-cpython-311
    │ creating build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/ogr.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/gdal.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/gdal_array.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/utils.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/gnm.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/osr.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/__init__.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ copying osgeo/gdalconst.py -> build/lib.linux-x86_64-cpython-311/osgeo
    │ creating build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdal_pansharpen.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdal_merge.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/rgb2pct.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdal_calc.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdal_edit.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdalmove.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
    │ copying gdal-utils/osgeo_utils/gdal2xyz.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils
[...]
    │ copying gdal-utils/osgeo_utils/auxiliary/base.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ copying gdal-utils/osgeo_utils/auxiliary/__init__.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ copying gdal-utils/osgeo_utils/auxiliary/util.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ copying gdal-utils/osgeo_utils/auxiliary/color_palette.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ copying gdal-utils/osgeo_utils/auxiliary/raster_creation.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ copying gdal-utils/osgeo_utils/auxiliary/progress.py -> build/lib.linux-x86_64-cpython-311/osgeo_utils/auxiliary
    │ running build_ext
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
    │ building 'osgeo._gdal' extension
    │ creating build/temp.linux-x86_64-cpython-311
    │ creating build/temp.linux-x86_64-cpython-311/extensions
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-cpython-311/extensions/gdal_wrap.o -I/usr/include/gdal
    │ building 'osgeo._osr' extension
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c extensions/osr_wrap.cpp -o build/temp.linux-x86_64-cpython-311/extensions/osr_wrap.o -I/usr/include/gdal
    │ building 'osgeo._gdalconst' extension
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c extensions/gdalconst_wrap.c -o build/temp.linux-x86_64-cpython-311/extensions/gdalconst_wrap.o -I/usr/include/gdal
    │ building 'osgeo._ogr' extension
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c extensions/ogr_wrap.cpp -o build/temp.linux-x86_64-cpython-311/extensions/ogr_wrap.o -I/usr/include/gdal
    │ building 'osgeo._gnm' extension
    │ gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/app/.heroku/python/include/python3.11 -I. -I/usr/include -c extensions/gnm_wrap.cpp -o build/temp.linux-x86_64-cpython-311/extensions/gnm_wrap.o -I/usr/include/gdal
    │ extensions/gdal_wrap.cpp:3198:10: fatal error: cpl_port.h: No such file or directory
    │ 3198 | #include "cpl_port.h"
    │ | ^~~~~~~~~~~~
    │ compilation terminated.
    │ extensions/gdalconst_wrap.c:3018:10: fatal error: gdal.h: No such file or directory
    │ 3018 | #include "gdal.h"
    │ | ^~~~~~~~
    │ compilation terminated.
    │ extensions/osr_wrap.cpp:3198:10: fatal error: cpl_string.h: No such file or directory
    │ 3198 | #include "cpl_string.h"
    │ | ^~~~~~~~~~~~~~
    │ compilation terminated.
    │ extensions/gnm_wrap.cpp:3135:10: fatal error: gdal.h: No such file or directory
    │ 3135 | #include "gdal.h"
    │ | ^~~~~~~~
    │ compilation terminated.
    │ extensions/ogr_wrap.cpp:3153:10: fatal error: gdal.h: No such file or directory
    │ 3153 | #include "gdal.h"
    │ | ^~~~~~~~
    │ compilation terminated.
    │ error: command '/usr/bin/gcc' failed with exit code 1
    │ [end of output]
    │
    │ note: This error originates from a subprocess, and is likely not a problem with pip.
    │ ERROR: Failed building wheel for GDAL
    │ Running setup.py clean for GDAL
    │ Failed to build GDAL
    │ ERROR: Could not build wheels for GDAL, which is required to install pyproject.toml-based projects
    │ ERROR: failed to build: exit status 1
    │
    │
    │ For documentation on the buildpacks used to build your app, please see:
    │
    │ Python v3.235.4 https://do.co/apps-buildpack-python
    │
    │ ✘ build failed
Error: command exited with a non-zero status code

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hey Bobby

Thanks for your response. We had already opened a ticket with DO and they are still working on it, but, thanks for you comments we found the solution.

Indded, we had the two variables setup on our app before

CPLUS_INCLUDE_PATH=/usr/include/gdal
C_INCLUDE_PATH=/usr/include/gdal

but after reading your message, I gave a new check/try and saw the logs of the build:

    │ LD_LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
    │ LIBRARY_PATH=/layers/digitalocean_apt/apt/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/lib:/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu:/layers/digitalocean_apt/apt/usr/lib
    │ INCLUDE_PATH=/layers/digitalocean_apt/apt/usr/include:/layers/digitalocean_apt/apt/usr/include/x86_64-linux-gnu
    │ CPATH=$INCLUDE_PATH
    │ PKG_CONFIG_PATH=/layers/digitalocean_apt/apt/usr/lib/x86_64-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/i386-linux-gnu/pkgconfig:/layers/digitalocean_apt/apt/usr/lib/pkgconfig
    │ => Installed 1 packages in 48s

Then, we changed the variables to:

CPLUS_INCLUDE_PATH=/layers/digitalocean_apt/apt/usr/include/gdal/
C_INCLUDE_PATH=/layers/digitalocean_apt/apt/usr/include/gdal/

and the installation of the GDAL worked as expected.

Thanks again for help us to fix it !! :-D

Bobby Iliev
Site Moderator
Site Moderator badge
March 3, 2024

Hey @victorhugodossantos,

Indeed it looks like the packages are being installed successfully.

Have you tried defining the following two env variables:

CPLUS_INCLUDE_PATH=/usr/include/gdal
C_INCLUDE_PATH=/usr/include/gdal

If this still fails, I could suggest reaching out to the DigitalOcean support team who might be able to advise you further:

https://www.digitalocean.com/support/

In the meantime, an alternative option here would be to use a Dockerfile instead:

https://docs.digitalocean.com/products/app-platform/reference/dockerfile/

Hope that helps!

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel