Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction with the APT buildpack can cause "libblas.so.3: cannot open shared object file" #18

Closed
edmorley opened this issue Nov 16, 2020 · 0 comments

Comments

@edmorley
Copy link
Member

edmorley commented Nov 16, 2020

Filing this in case it helps anyone else debugging.

Builds using this buildpack can fail with the following error:
OSError: libblas.so.3: cannot open shared object file: No such file or directory

...if all of the following are true:

  • the app is also using the APT buildpack
  • the APT buildpack runs after the Geo buildpack
  • the Aptfile contains gdal related dependencies (such as gdal-bin)

Example:

$ mkdir testapp-geo-buildpack && cd $_ && git init && h create --stack heroku-18
$ h buildpacks:add https://github.com/heroku/heroku-geo-buildpack
$ h buildpacks:add heroku-community/apt
$ h buildpacks:add heroku/python
$ echo 'gdal-bin' > Aptfile
$ echo 'python-3.8.3' > runtime.txt
$ touch requirements.txt
$ mkdir -p bin
$ cat > bin/post_compile <<EOF
#!/usr/bin/env python
from ctypes import CDLL
from ctypes.util import find_library

lib_path = find_library('gdal')
print(lib_path)
CDLL(lib_path)
EOF
$ git add -A; git commit -m '.' && git push heroku main
...
remote: -----> Running post-compile hook
remote: libgdal.so.20
remote: Traceback (most recent call last):
remote:   File "bin/post_compile", line 9, in <module>
remote:     CDLL(lib_path)
remote:   File "/app/.heroku/python/lib/python3.8/ctypes/__init__.py", line 373, in __init__
remote:     self._handle = _dlopen(self._name, mode)
remote: OSError: libblas.so.3: cannot open shared object file: No such file or directory

If you experience the above error, the way to resolve is to either:

  1. Remove gdal related dependencies from Aptfile (and leave them to the Geo buildpack)
  2. Or, if you really need those dependencies for some reason (even though they duplicate the libraries used in this buildpack), then change the buildpack order, such that the Geo buildpack is after the APT buildpack, so that the GDAL libraries are used from the Geo buildpack and not the broken install from the APT buildpack

The long term solution is for the APT buildpack to fix heroku/heroku-buildpack-apt/issues/64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant