cgtinker / BlendArMocap

realtime motion tracking in blender using mediapipe and rigify
GNU General Public License v3.0
916 stars 111 forks source link

Linux: The addon does not find user-installed dependencies #118

Closed xenogenesi closed 1 year ago

xenogenesi commented 1 year ago

Hello

I would like to try the addon but I have dependency problems, the system is debian/sid, I don't intend to run blender with root privileges to install python packages (btw ensurepip is disabled in debian distros, I guess ubuntu too but I can't verify) so I installed them manually and the installation was successful, but the addon doesn't seem to find them.

Is there a way to bypass the checks or to check local installs as well?

The "main" branch behaves better than the last release, at least the UI appears, but the mediapipe tab contains instructions for installing the dependencies.

Thanks in advance

% cd /home/alex/.config/blender/3.4/scripts/addons/BlendArMocap-main
%  pip install -r requirements.txt 
Defaulting to user installation because normal site-packages is not writeable
Collecting absl-py
  Downloading absl_py-1.4.0-py3-none-any.whl (126 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 126.5/126.5 kB 3.4 MB/s eta 0:00:00
Requirement already satisfied: attrs>=19.1.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (22.2.0)
Requirement already satisfied: matplotlib in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (3.6.3)
Collecting opencv-contrib-python>=4.5.5.64
  Downloading opencv_contrib_python-4.7.0.68-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (67.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.9/67.9 MB 8.8 MB/s eta 0:00:00
Collecting protobuf<=3.20.0,>=3.11.4
  Downloading protobuf-3.20.0-py2.py3-none-any.whl (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.1/162.1 kB 9.5 MB/s eta 0:00:00
Collecting mediapipe>=0.8.10
  Downloading mediapipe-0.9.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (33.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 33.0/33.0 MB 4.0 MB/s eta 0:00:00
Requirement already satisfied: numpy>=1.21.2 in /usr/lib/python3/dist-packages (from opencv-contrib-python>=4.5.5.64->-r requirements.txt (line 4)) (1.24.1)
Collecting flatbuffers>=2.0
  Downloading flatbuffers-23.1.21-py2.py3-none-any.whl (26 kB)
Installing collected packages: flatbuffers, protobuf, opencv-contrib-python, absl-py, mediapipe
Successfully installed absl-py-1.4.0 flatbuffers-23.1.21 mediapipe-0.9.0.1 opencv-contrib-python-4.7.0.68 protobuf-3.20.0
% pip show mediapipe 
Name: mediapipe
Version: 0.9.0.1
Summary: MediaPipe is the simplest way for researchers and developers to build world-class ML solutions and applications for mobile, edge, cloud and the web.
Home-page: https://github.com/google/mediapipe
Author: The MediaPipe Authors
Author-email: mediapipe@google.com
License: Apache 2.0
Location: /home/alex/.local/lib/python3.11/site-packages
Requires: absl-py, attrs, flatbuffers, matplotlib, numpy, opencv-contrib-python, protobuf
Required-by: 
%  python
# at 20:04:28
Python 3.11.1 (main, Dec 31 2022, 10:23:59) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mediapipe
>>> mediapipe.__version__
'0.9.0.1'
>>> 
python -m ensurepip
ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules for the system python are usually handled by dpkg and apt-get.

    apt install python3-<module name>

Install the python3-pip package to use pip itself.  Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.
cgtinker commented 1 year ago

Hey there, thanks for all the info. I'll enable an option to use the users site packages soon and let you know.

xenogenesi commented 1 year ago

Thanks, looking forward to it

cgtinker commented 1 year ago

@xenogenesi can you pull the current version from the main branch and give it a try? I'm a not sure if I should append the local user site packages by default to blenders sys path.. but for now it should do the trick.

xenogenesi commented 1 year ago

Thanks, I see the UI now, when I try to use it to detect a pose from an mp4 video however Blender gets a SIGSEGV. It looks like a problem related to the opencv installation but I'm not sure. I tried the mediapipe python example for poses with the same video and it doesn't give me any problems (apart from that in some frames it doesn't resolve all the limbs)

SEGV backtrace ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f5004205263 in find_atom_pointer () from /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 [Current thread is 1 (Thread 0x7f50a0554b80 (LWP 12358))] (gdb) bt #0 0x00007f5004205263 in find_atom_pointer () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 #1 0x00007f500420548e in atom_intern () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 #2 0x00007f5004204ff5 in xkb_keymap_new () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 #3 0x00007f5004202caf in xkb_x11_keymap_new_from_device () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libxkbcommon-x11-c65ed502.so.0.0.0 #4 0x00007f502228d558 in () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-dcb826d0.so.5.15.0 #5 0x00007f50222882a4 in QtOpenCVPython::QXcbConnection::QXcbConnection(QtOpenCVPython::QXcbNativeInterface*, bool, unsigned int, char const*) () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-dcb826d0.so.5.15.0 #6 0x00007f502228ac87 in QtOpenCVPython::QXcbIntegration::QXcbIntegration(QtOpenCVPython::QStringList const&, int&, char**) () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/../../../../opencv_python.libs/libQt5XcbQpa-dcb826d0.so.5.15.0 #7 0x00007f504f75043f in () at /home/alex/.local/lib/python3.11/site-packages/cv2/qt/plugins/platforms/libqxcb.so #8 0x00007f502d34da7c in QtOpenCVPython::QGuiApplicationPrivate::createPlatformIntegration() () at /home/alex/.local/lib/python3.11/site-packages/cv2/../opencv_python.libs/libQt5Gui-dd62182f.so.5.15.0 #9 0x00007f502d34f020 in QtOpenCVPython::QGuiApplicationPrivate::createEventDispatcher() () at /home/alex/.local/lib/python3.11/site-packages/cv2/../opencv_python.libs/libQt5Gui-dd62182f.so.5.15.0 #10 0x00007f502ccc82f6 in QtOpenCVPython::QCoreApplicationPrivate::init() () at /home/alex/.local/lib/python3.11/site-packages/cv2/../opencv_python.libs/libQt5Core-b6e66ee2.so.5.15.0 #11 0x00007f502d351a4b in QtOpenCVPython::QGuiApplicationPrivate::init() () at /home/alex/.local/lib/python3.11/site-packages/cv2/../opencv_python.libs/libQt5Gui-dd62182f.so.5.15.0 #12 0x00007f502dd98979 in QtOpenCVPython::QApplicationPrivate::init() () at /home/alex/.local/lib/python3.11/site-packages/cv2/../opencv_python.libs/libQt5Widgets-e69d94fb.so.5.15.0 #13 0x00007f5030e47707 in () at /home/alex/.local/lib/python3.11/site-packages/cv2/cv2.abi3.so #14 0x00007f5030e535cd in () at /home/alex/.local/lib/python3.11/site-packages/cv2/cv2.abi3.so #15 0x00007f5030e41abc in () at /home/alex/.local/lib/python3.11/site-packages/cv2/cv2.abi3.so #16 0x00007f502ff78e23 in () at /home/alex/.local/lib/python3.11/site-packages/cv2/cv2.abi3.so #17 0x00007f50b6fc9753 in () at /lib/x86_64-linux-gnu/libpython3.11.so.1.0 #18 0x00007f50b6f7baed in _PyObject_MakeTpCall () at /lib/x86_64-linux-gnu/libpython3.11.so.1.0 #19 0x00007f50b6f09c63 in _PyEval_EvalFrameDefault () at /lib/x86_64-linux-gnu/libpython3.11.so.1.0 #20 0x00007f50b706a6da in () at /lib/x86_64-linux-gnu/libpython3.11.so.1.0 #21 0x000055f3df259b2f in () #22 0x000055f3df21ee8b in () #23 0x000055f3ded7dc44 in () #24 0x000055f3ded7f185 in () #25 0x000055f3ded7f7ed in () #26 0x000055f3ded80321 in () #27 0x000055f3ded73d30 in () --Type for more, q to quit, c to continue without paging-- #28 0x000055f3de71222a in () #29 0x00007f50b684618a in __libc_start_call_main (main=main@entry=0x55f3de711f60, argc=argc@entry=1, argv=argv@entry=0x7ffdad115a38) at ../sysdeps/nptl/libc_start_call_main.h:58 #30 0x00007f50b6846245 in __libc_start_main_impl (main=0x55f3de711f60, argc=1, argv=0x7ffdad115a38, init=, fini=, rtld_fini=, stack_end=0x7ffdad115a28) at ../csu/libc-start.c:381 #31 0x000055f3de762c61 in () ```
cgtinker commented 1 year ago

@xenogenesi isn't python 3.10 the default version for blender 3.4? Please go in blenders scripting workspace and use the interactive console to check blenders python version and the site packages:

import sys
sys.executable
import site
site.getusersitepackages()

do the versions match?

next up, lets check if there any duplicate entries which might collide:

import subprocess
subprocess.run([sys.executable, "-m", "pip", "freeze"])

In the console window you'll see the installed packages. Does this only occur with videos or also when using a webcam (the behaviour should be the same). As it's a SIGSEGV there is prolly something pointing to NULL... will try to reproduce it but that may be tricky

xenogenesi commented 1 year ago

I'm not expert but I think Blender is using the current selected system installation of Python (there could be multiple via update-alternative), something is changing though on Debian systems, after opening this issue, during a system upgrade got an email about pip (not clear to me if the changes are already in place, I installed some package with pip without venv and seems to work)

I'll do a test with a webcam and let you know. Thanks.

python changes on debian Date: Mon, 6 Feb 2023 08:51:13 +0100 (CET) python-pip (23.0+dfsg-2) unstable; urgency=medium This version of pip introduces PEP 668 support. Debian's python3.11 interpreter will soon (>= 3.11.1-3) declare the installation to be EXTERNALLY-MANAGED, instructing pip to disallow package installation outside virtualenvs. See: https://peps.python.org/pep-0668/ Practically, this means that you can't use pip to install packages outside a virtualenv, on Debian's Python interpreter by default, any more. You can override this behaviour by passing --break-system-packages to pip install, but be aware that if you are running pip as root, doing so can break your system. See /usr/share/doc/python3.11/README.venv for more details. If that isn't available yet, check: https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/README.venv
shell+console output Blender Python console: ``` PYTHON INTERACTIVE CONSOLE 3.11.1 (main, Dec 31 2022, 10:23:59) [GCC 12.2.0] Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, gpu, blf, mathutils Convenience Imports: from mathutils import *; from math import * Convenience Variables: C = bpy.context, D = bpy.data >>> import sys >>> sys.executable '/usr/bin/python3.11' >>> import site >>> site.getusersitepackages() '/home/alex/.local/lib/python3.11/site-packages' >>> import subprocess >>> subprocess.run([sys.executable, "-m", "pip", "freeze"]) CompletedProcess(args=['/usr/bin/python3.11', '-m', 'pip', 'freeze'], returncode=0) >>> ``` Blender output on terminal: ``` Read prefs: /home/alex/.config/blender/3.4/config/userpref.blend Reloading external rigs... Reloading external metarigs... Added user site packages to path. (3, 4, 1) Python Executable: /usr/bin/python3.11. absl-py==1.4.0 aeidon==1.11 anyio==3.6.2 appdirs==1.4.4 apsw==3.40.0.0 astroid==2.13.3 asttokens==2.2.1 async-timeout==4.0.2 attrs==22.2.0 backcall==0.2.0 backoff==2.2.1 beautifulsoup4==4.11.2 beniget==0.4.1 blinker==1.5 boto3==1.26.57 botocore==1.29.57 Brotli==1.0.9 cached-property==1.5.2 cairocffi==1.4.0 CairoSVG==2.5.2 certifi==2022.9.24 cffi==1.15.1 chardet==5.1.0 charset-normalizer==3.0.1 click==8.1.3 click-log==0.3.2 colorama==0.4.6 configobj==5.0.8 contourpy==1.0.7 cryptography==38.0.4 css-parser==1.0.8 cssselect==1.2.0 cssselect2==0.7.0 cupshelpers==1.0 cycler==0.11.0 Cython==0.29.32 dbus-python==1.3.2 debmake==4.4.0 debtags==2.1 decorator==5.1.1 defcon==0.10.1 defusedxml==0.7.1 devscripts==2.23.0 dill==0.3.6 distlib==0.3.6 distro==1.8.0 dnspython==2.3.0 docker==5.0.3 docker-compose==1.29.2 dockerpty==0.4.1 docopt==0.6.2 exceptiongroup==1.1.0 executing==1.2.0 feedparser==6.0.10 filelock==3.9.0 flake8==6.0.0 flatbuffers==23.1.21 fontPens==0.2.4 fonttools==4.38.0 fs==2.4.16 gast==0.5.2 gbp==0.9.30 glfw==2.5.6 gql==3.4.0 graphql-core==3.2.3 gyp==0.1 h11==0.14.0 h2==4.1.0 hpack==4.0.0 html2text==2020.1.16 html5-parser==0.4.10 html5lib==1.1 httpcore==0.16.3 httplib2==0.20.4 httpx==0.23.3 hyperframe==6.0.0 idna==3.3 ifaddr==0.1.7 importlib-metadata==4.12.0 iniconfig==1.1.1 iotop==0.6 ipython==8.5.0 isodate==0.6.1 isort==5.6.4 jedi==0.18.2 jeepney==0.8.0 jmespath==1.0.1 jsonpointer==2.3 jsonschema==4.10.3 kiwisolver==0.0.0 lazr.restfulclient==0.14.5 lazr.uri==1.0.6 lazy-object-proxy==1.9.0 libevdev==0.5 logilab-common==1.9.8 lxml==4.9.2 lz4==4.0.2+dfsg Magnus==1.0.3 Markdown==3.4.1 markdown-it-py==2.1.0 matplotlib==3.6.3 matplotlib-inline==0.1.6 mccabe==0.7.0 mdurl==0.1.2 mechanize==0.4.8 mediapipe==0.9.0.1 meson==1.0.0 Mirage==0.11.1 more-itertools==8.10.0 mpmath==0.0.0 msgpack==1.0.3 multidict==6.0.4 mutagen==1.46.0 mypy-extensions==0.4.3 mysqlclient==1.4.6 netifaces==0.11.0 ntpsec==1.2.2 numpy==1.24.1 oauthlib==3.2.2 olefile==0.46 opencv-contrib-python==4.7.0.68 opencv-python==4.7.0.68 opencv-python-headless==4.7.0.68 packaging==23.0 parso==0.8.3 pexpect==4.8.0 pickleshare==0.7.5 Pillow==9.4.0 platformdirs==2.6.0 pluggy==1.0.0+repack ply==3.11 prompt-toolkit==3.0.36 protobuf==3.20.2 psutil==5.9.4 ptyprocess==0.7.0 pure-eval==0.0.0 py==1.11.0 py7zr==0.11.3+dfsg pyasn1==0.4.8 pyasn1-modules==0.2.8 pyassimp==4.1.4 PyAudio==0.2.13 pycairo==1.20.1 pychm==0.8.6 pycodestyle==2.10.0 pycountry==22.3.5 pycparser==2.21 pycryptodomex==3.11.0 pycups==2.0.1 pycurl==7.45.2 pyflakes==3.0.1 pygame==2.1.2 Pygments==2.14.0 PyGObject==3.42.2 pyinotify==0.9.6 PyJWT==2.6.0 pylint==2.15.10 pymediainfo==6.0.1 PyOpenGL==3.1.6 pyOpenSSL==23.0.0 pyparsing==3.0.9 pyperclip==1.8.2 PyQt5==5.15.8 PyQt5-sip==12.11.1 PyQt6==6.4.1 PyQt6-sip==13.4.1 PyQt6-WebEngine==6.4.0 pyrsistent==0.18.1 PySimpleSOAP==1.16.2 PySocks==1.7.1 pytest==7.2.1 python-apt==2.5.2+b1 python-dateutil==2.8.2 python-debian==0.1.49 python-debianbts==4.0.1 python-dotenv==0.21.0 python-pam==2.0.2 python-xlib==0.33 python3-lxc==5.0.0 pythran==0.11.0 pytz==2022.7.1 pyudev==0.24.0 pyxattr==0.8.0 pyxdg==0.28 PyYAML==6.0 qrtools==2.1 ranger-fm==1.9.3 regex==2022.10.31 reportbug==11.6.0 repoze.lru==0.7 requests==2.28.1 requests-toolbelt==0.10.1 rfc3986==1.5.0 rfc3987==1.3.8 rich==13.2.0 Routes==2.5.1 s3transfer==0.6.0 scipy==1.10.0 SCons==4.4.0 scour==0.38.2 setproctitle==1.3.1 sgmllib3k==1.0.0 six==1.16.0 sniffio==1.2.0 soupsieve==2.3.2 speedtest-cli==2.1.3 stack-data==0.6.2 streamlink==5.2.1 sympy==1.11.1 terminator==2.1.2 texttable==1.6.7 tinycss==0.4 tinycss2==1.2.1 toml==0.10.2 tomli==2.0.1 tomlkit==0.11.6 toolz==0.12.0 tornado==6.2 tqdm==4.64.1 traitlets==5.5.0 typing_extensions==4.4.0 ufoLib2==0.14.0 unicodedata2==15.0.0 uritemplate==4.1.1 urllib3==1.26.12 urwid==2.1.2 vboxapi==1.0 virtualenv==20.17.1+ds wadllib==1.3.6 wcwidth==0.2.5 webcolors==1.11.1 webencodings==0.5.1 WebOb==1.8.6 websocket-client==1.2.3 websockets==10.4 wrapt==1.14.1 wxPython==4.2.0 xcffib==0.11.1 xdg==5 xlrd==1.2.0 yarl==1.8.2 yt-dlp==2023.1.6 zeroconf==0.47.1 zipp==1.0.0 ```
cgtinker commented 1 year ago

Whats catches my is:

opencv-contrib-python==4.7.0.68
opencv-python==4.7.0.68
opencv-python-headless==4.7.0.68

Usually you want just one of those in an environment. I can imagine that this can cause trouble. But I've been wondering why the mediapipe samples are running. As this is the case, could you try just running the holistic detection script from the add-on? BlendArMocap/src/cgt_mediapipe/cgt_mp_core/mp_holistic_detector.py

As local site packages can cause such behaviours I probably cannot link them by default. Guess they will only be linked in the future while "local user" is toggled.

However, usually you only want opencv-contrib-python==4.7.0.68 in your environment for mediapipe.

xenogenesi commented 1 year ago

I haven't had the chance to try the cam yet, today I'll try.

The three packages installed are my fault, when I saw that cv had problems I did some "tests", but I confirm that the Mediapipe example for poses works, just did a quick test.

mp_holistic_detector.py:

% cd  BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core
% python3 mp_holistic_detector.py
Traceback (most recent call last):
  File "/home/alex/.config/blender/3.4/scripts/addons/BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core/mp_holistic_detector.py", line 3, in <module>
    from . import cv_stream, mp_detector_node
ImportError: attempted relative import with no known parent package
cgtinker commented 1 year ago

I haven't had the chance to try the cam yet, today I'll try.

The three packages installed are my fault, when I saw that cv had problems I did some "tests", but I confirm that the Mediapipe example for poses works, just did a quick test.

mp_holistic_detector.py:

% cd  BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core
% python3 mp_holistic_detector.py
Traceback (most recent call last):
  File "/home/alex/.config/blender/3.4/scripts/addons/BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core/mp_holistic_detector.py", line 3, in <module>
    from . import cv_stream, mp_detector_node
ImportError: attempted relative import with no known parent package

That's just due to relative imports which are preferred for blender add-ons. You got to start the script using it's module path. Ensure to be in the BlendArMocap directory when executing the cmd.

python3 -m src.cgt_mediapipe.cgt_mp_core.mp_holistic_detector
xenogenesi commented 1 year ago
% python3 -m src.cgt_mediapipe.cgt_mp_core.mp_holistic_detector
[ WARN:0@0.312] global cap_v4l.cpp:982 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ERROR:0@0.312] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range
[ WARN:0@0.562] global cap_v4l.cpp:982 open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ERROR:0@0.562] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/alex/.config/blender/3.4/scripts/addons/BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core/mp_holistic_detector.py", line 70, in <module>
    detector = HolisticDetector(cv_stream.Stream(0))
                                ^^^^^^^^^^^^^^^^^^^
  File "/home/alex/.config/blender/3.4/scripts/addons/BlendArMocap-main/src/cgt_mediapipe/cgt_mp_core/cv_stream.py", line 30, in __init__
    raise IOError("Cannot open webcam")
OSError: Cannot open webcam

With the cam it show a capture window for a second:

% python3 -m src.cgt_mediapipe.cgt_mp_core.mp_holistic_detector
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

With the cam and the Mediapipe pose example show the same capture window and works.

So I tried the plugin in blender, Movie and Cam, Face, Hands, Pose and Holistic, blender segv every time (same backtrace already posted)

Thanks for the support

cgtinker commented 1 year ago

Did you try removing the packages already?

> opencv-contrib-python==4.7.0.68
> opencv-python==4.7.0.68
> opencv-python-headless==4.7.0.68

I still can imagine that those are causing the issue, even though I'm confused that it seems to be running outside blender. Recommended for mediapipe is opencv-contrib-python==4.7.0.68. In the stack trace it seems that opencv-python is getting accessed. Usually I'd recommend to uninstall via pip, but due to weird packaging that usually doesn't work properly. The easiest is to do it manually.

# navigate to your local site packages
cd /home/alex/.local/lib/python3.11/site-packages

# find cv entries
ls | grep cv

# move or remove them
rm -r opencv_contrib.......
rm -r cv2

# reinstall opencv-contrib (I usually use version opencv-contrib-python==4.5.5.64 but I'm not sure which is the best on ubuntu atm, without specifying you'll instal the newest version)
python3 -m pip install opencv-contrib-python
xenogenesi commented 1 year ago

I removed the directories + uninstalled with pip (because pip freeze kept showing the 3 packages) and reinstalled the addon requirements with pip, which installed opencv-contrib-python==4.7.0.68, but blender kept crashing always with the same backtrace.

So, I uninstalled opencv-contrib-python and installed python3-opencv from debian, which installs cv2 '4.6.0', now "Detect" with a Movie seems to work, no crashes (my guess is that there's some binary incompatibility)

I'll do more in-depth tests of the addon as soon as I have time, if I have problems I'll let you know but as far as I'm concerned you can close this issue, if you want to do more tests to better understand the problem just let me know.

Thanks for the support and for the addon!

xenogenesi commented 1 year ago

I did few more test, any version of opencv-contrib-python works as long as python3-opencv (cv2) is installed from the debian package, it even works without opencv-contrib-python (is installed only for its version of cv2?), version 4.5.5.64 alone crash as well.

I see in /proc/$(pidof blender)/maps that the one installed by the system take precedence over opencv-contrib-python when installed (/usr/lib/python3/dist-packages/cv2.cpython-311-x86_64-linux-gnu.so)

cgtinker commented 1 year ago

I did few more test, any version of opencv-contrib-python works as long as python3-opencv (cv2) is installed from the debian package, it even works without opencv-contrib-python (is installed only for its version of cv2?), version 4.5.5.64 alone crash as well.

I see in /proc/$(pidof blender)/maps that the one installed by the system take precedence over opencv-contrib-python when installed (/usr/lib/python3/dist-packages/cv2.cpython-311-x86_64-linux-gnu.so)

thanks for all the infos! Sadly that's something which seems rly hard to integrate into the add-on. By now I've heard of different binary issues on linux. Often it boils down to trail and error. :/ Glad you got opencv running and to know that the debian package seems to help.