import python opencv

When importing cv2, i'm getting that error : ImportError: libGL.so.1: cannot open shared object file: No such file or directory
15 Replies
Percy
Percy2y ago
Project ID: 13160e48-de83-4357-ae78-221b90810634
Percy
Percy2y ago
⚠️ experimental feature
_Alex_
_Alex_OP2y ago
13160e48-de83-4357-ae78-221b90810634
Brody
Brody2y ago
do you have a nixpacks.toml?
_Alex_
_Alex_OP2y ago
i'm trying rn to add [phases.setup] aptPkgs = ["ffmpeg", "libsm6", "libxext6"]
Brody
Brody2y ago
before you do that, try adding opencv-python to your requirements.txt file
_Alex_
_Alex_OP2y ago
already done didn't work
Brody
Brody2y ago
then try this nixpacks.toml file
[phases.setup]
aptPkgs = ["...", "libgl1"]
[phases.setup]
aptPkgs = ["...", "libgl1"]
_Alex_
_Alex_OP2y ago
same error Traceback (most recent call last): File "main.py", line 7, in <module> import cv2 File "/opt/venv/lib/python3.8/site-packages/cv2/init.py", line 181, in <module> bootstrap() File "/opt/venv/lib/python3.8/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/nix/store/9493ngfjwisjm5f5s5ld5m34rdy431ic-python3-3.8.16/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: libGL.so.1: cannot open shared object file: No such file or directory @Brody
Brody
Brody2y ago
please dont ping me like that
_Alex_
_Alex_OP2y ago
oh sorry
Brody
Brody2y ago
replace opencv-python with opencv-python-headless
_Alex_
_Alex_OP2y ago
thx
Brody
Brody2y ago
works?
Alec
Alec10mo ago
Just changing from opencv-python to opencv-python-headless in my pip worked for me. Thanks!
Want results from more Discord servers?
Add your server