Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

heroku

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?

like image 413
Miriam Avatar asked Sep 11 '20 10:09

Miriam


3 Answers

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.

like image 190
Piotr Wieczorek Avatar answered Oct 29 '22 04:10

Piotr Wieczorek


I had the same issue and I added the following line in my requirements.txt:

opencv-python-headless==4.2.0.32

It worked for me.

like image 31
Ashish Tripathi Avatar answered Oct 29 '22 04:10

Ashish Tripathi


First run

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

Create Aptfile and add libgl1

like image 5
Sanju P K Avatar answered Oct 29 '22 04:10

Sanju P K