#import python opencv

17 messages · Page 1 of 1 (latest)

icy kindle
#

When importing cv2, i'm getting that error :
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

hollow pivotBOT
#

Project ID: 13160e48-de83-4357-ae78-221b90810634

icy kindle
#

13160e48-de83-4357-ae78-221b90810634

ornate lynx
#

do you have a nixpacks.toml?

icy kindle
#

i'm trying rn to add [phases.setup]
aptPkgs = ["ffmpeg", "libsm6", "libxext6"]

ornate lynx
#

before you do that, try adding opencv-python to your requirements.txt file

icy kindle
#

already done

ornate lynx
#

then try this nixpacks.toml file

[phases.setup]
aptPkgs = ["...", "libgl1"]
icy kindle
#

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

#

@ornate lynx

ornate lynx
#

please dont ping me like that

icy kindle
#

oh sorry

ornate lynx
#

replace opencv-python with opencv-python-headless

icy kindle
#

thx

ornate lynx
#

works?