R
Railway12mo ago
Pedroo

I cannot use opencv2 and received ImportError: libgl.so.1 cannot open shared object file no such fil

Can anyone help me with that ??
Solution:
use the headless version of the opencv package
Jump to solution
31 Replies
Percy
Percy12mo ago
Project ID: 5a3e0b60-6df7-46d9-95dd-0dd4e2b53849
Pedroo
Pedroo12mo ago
5a3e0b60-6df7-46d9-95dd-0dd4e2b53849 project id
Pedroo
Pedroo12mo ago


Brody
Brody12mo ago
send your requirements.txt file please
Pedroo
Pedroo12mo ago
yes now aiohttp==3.8.5 aiosignal==1.3.1 async-timeout==4.0.2 attrs==23.1.0 blinker==1.6.2 camelot-py==0.11.0 certifi==2023.7.22 cffi==1.15.1 chardet==5.1.0 charset-normalizer==3.2.0 click==8.1.6 colorama==0.4.6 cryptography==41.0.2 distro==1.8.0 et-xmlfile==1.1.0 flask==2.3.3 Flask-Cors==4.0.0 frozenlist==1.4.0 ghostscript==0.7 greenlet==2.0.2 idna==3.4 importlib-metadata==6.8.0 itsdangerous==2.1.2 Jinja2==3.1.2 lxml==4.9.3 MarkupSafe==2.1.3 multidict==6.0.4 numpy==1.25.2 openai==0.27.8 opencv-python==4.8.0.74 openpyxl==3.1.2 pandas==2.0.3 pdfminer.six==20221105 pdftopng==0.2.3 Pillow==10.0.0 psycopg2==2.9.7 pycparser==2.21 pypdf==3.14.0 pypdf2==3.0.1 python-dateutil==2.8.2 python-docx==0.8.11 pytz==2023.3 requests==2.31.0 six==1.16.0 SQLAlchemy==2.0.20 tabula-py==2.7.0 tabulate==0.9.0 tqdm==4.65.0 typing-extensions==4.7.1 tzdata==2023.3 Unidecode==1.3.6 urllib3==2.0.4 werkzeug==2.3.7 yarl==1.9.2 zipp==3.16.2
Brody
Brody12mo ago
are you using all of those packages?
Pedroo
Pedroo12mo ago
most of is dependencys of others
Brody
Brody12mo ago
side note, please enclose all code / code-like text blocks in triple back ticks
Pedroo
Pedroo12mo ago
sorry, i don't understand, u need the code ?
Brody
Brody12mo ago
nevermind
aiohttp==3.8.5
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
blinker==1.6.2
camelot-py==0.11.0
certifi==2023.7.22
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
cryptography==41.0.2
distro==1.8.0
et-xmlfile==1.1.0
flask==2.3.3
Flask-Cors==4.0.0
frozenlist==1.4.0
ghostscript==0.7
greenlet==2.0.2
idna==3.4
importlib-metadata==6.8.0
itsdangerous==2.1.2
Jinja2==3.1.2
lxml==4.9.3
MarkupSafe==2.1.3
multidict==6.0.4
numpy==1.25.2
openai==0.27.8
opencv-python-headless==4.8.0.74
openpyxl==3.1.2
pandas==2.0.3
pdfminer.six==20221105
pdftopng==0.2.3
Pillow==10.0.0
psycopg2==2.9.7
pycparser==2.21
pypdf==3.14.0
pypdf2==3.0.1
python-dateutil==2.8.2
python-docx==0.8.11
pytz==2023.3
requests==2.31.0
six==1.16.0
SQLAlchemy==2.0.20
tabula-py==2.7.0
tabulate==0.9.0
tqdm==4.65.0
typing-extensions==4.7.1
tzdata==2023.3
Unidecode==1.3.6
urllib3==2.0.4
werkzeug==2.3.7
yarl==1.9.2
zipp==3.16.2
aiohttp==3.8.5
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
blinker==1.6.2
camelot-py==0.11.0
certifi==2023.7.22
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.2.0
click==8.1.6
colorama==0.4.6
cryptography==41.0.2
distro==1.8.0
et-xmlfile==1.1.0
flask==2.3.3
Flask-Cors==4.0.0
frozenlist==1.4.0
ghostscript==0.7
greenlet==2.0.2
idna==3.4
importlib-metadata==6.8.0
itsdangerous==2.1.2
Jinja2==3.1.2
lxml==4.9.3
MarkupSafe==2.1.3
multidict==6.0.4
numpy==1.25.2
openai==0.27.8
opencv-python-headless==4.8.0.74
openpyxl==3.1.2
pandas==2.0.3
pdfminer.six==20221105
pdftopng==0.2.3
Pillow==10.0.0
psycopg2==2.9.7
pycparser==2.21
pypdf==3.14.0
pypdf2==3.0.1
python-dateutil==2.8.2
python-docx==0.8.11
pytz==2023.3
requests==2.31.0
six==1.16.0
SQLAlchemy==2.0.20
tabula-py==2.7.0
tabulate==0.9.0
tqdm==4.65.0
typing-extensions==4.7.1
tzdata==2023.3
Unidecode==1.3.6
urllib3==2.0.4
werkzeug==2.3.7
yarl==1.9.2
zipp==3.16.2
replace your requirements.txt with this
Pedroo
Pedroo12mo ago
ah okay i will test oh men u save my work literally thank u so much
Brody
Brody12mo ago
no problem!
Pedroo
Pedroo12mo ago
[2023-08-25 15:20:17 +0000] [10] [INFO] Worker exiting (pid: 10)  [2023-08-25 15:20:18 +0000] [1] [INFO] Shutting down: Master  [2023-08-25 15:20:18 +0000] [1] [INFO] Reason: App failed to load.  [2023-08-25 15:20:21 +0000] [1] [INFO] Starting gunicorn 20.0.4  [2023-08-25 15:20:21 +0000] [1] [INFO] Listening at: http://0.0.0.0:6210 (1)  [2023-08-25 15:20:21 +0000] [1] [INFO] Using worker: sync  [2023-08-25 15:20:21 +0000] [10] [INFO] Booting worker with pid: 10  Failed to find attribute 'app' in 'main'. only code error now, but i solve thank u sooooooooo much ❤️
Brody
Brody12mo ago
do you have a main.py?
Pedroo
Pedroo12mo ago
yees
Brody
Brody12mo ago
flask?
Pedroo
Pedroo12mo ago
i think is this the error
Pedroo
Pedroo12mo ago
Pedroo
Pedroo12mo ago
Brody
Brody12mo ago
yeah move all that stuff outside of the main() function
Pedroo
Pedroo12mo ago
okaay
Brody
Brody12mo ago
and make sure you have this thing https://github.com/railwayapp-templates/flask/blob/main/main.py#L12-L13 that if statement is very important
Pedroo
Pedroo12mo ago
Pedroo
Pedroo12mo ago
i will modify for equal than your
Brody
Brody12mo ago
yeah make it look like the template
Pedroo
Pedroo12mo ago
yeeeeeeeeeeees 😄 this go up Ops, already did, thank u so much meen <3, i will apresentate this project today haha
Brody
Brody12mo ago
I will just mark as solved, this question was far too specific to your app to mark a solution
Pedroo
Pedroo12mo ago
A okaaay Thanks for all support.
Brody
Brody12mo ago
oh wait I can just do this
Solution
Brody
Brody12mo ago
use the headless version of the opencv package
Brody
Brody12mo ago
there we go, happy I could help