Search code examples
heroku

ImportError: libGL.so.1 : error when accessing Heroku app


I have a probem with accessing my heroku app because of following error

2020-09-11T10:25:09.492648+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

What i already tried is:

  1. Add Aptfile with
  • libsm6
  • libxrender1
  • libfontconfig1
  • libice6
  1. Add buildpack https://github.com/heroku/heroku-buildpack-apt
  2. use opencv-python-headless in requirements

nothing works.

Does anyone know what the problem is?


Solution

  • TL:DR - Add 'libgl1' to Aptfile.

    I guess the fix for any type of import error works like this:

    If you have library error like libGL.so.1 you should take the name of the library in lowercase (in this case 'libgl') and add the number at the end of the name (in this case it's '1') - so you get a word libgl1. Now write that word into Aptfile.

    If you don't have Aptfile just create it in the root folder - this file does not have any extension.