termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.15k stars 3.02k forks source link

[Bug]: OpenCV is not working #20334

Closed Ar57m closed 4 months ago

Ar57m commented 4 months ago

Problem description

recently I pkg update everything, and cv2 stopped working, somebody know how to fix it? I forgot to copy the logs of the update but I have a screenshot, Screenshot_20240526_214418_Termux

the error running the python script:

Traceback (most recent call last):
  File "/data/data/com.termux/files/home/another/runner.py", line 3, in <module>
    import cv2
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: dlopen failed: cannot locate symbol "_ZN4absl12lts_2023080212log_internal9kCharNullE" referenced by "/data/data/com.termux/files/usr/lib/libopencv_dnn.so"...

What steps will reproduce the bug?

pkg update and upgrade run a python script importing cv2

What is the expected behavior?

import cv2

System information

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=18146
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.vern.cc/termux/termux-main stable main
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
Updatable packages:
All packages up to date
termux-tools version:
1.42.1
Android version:
13
Kernel build information:
Linux localhost 5.4.210-qgki-27101688-abM526BXXS4CWL2 #1 SMP PREEMPT Wed Dec 27 18:07:41 KST 2023 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-M526B
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Ar57m commented 4 months ago

btw i got this warning installing opencv


WARNING: opencv-python is compiled with numpy 1.26.2, but numpy 1.26.4 is installed. Please report it to https://github.com/termux/termux-packages if any bug happens. 
`` 
licy183 commented 4 months ago

opencv has been removed from main to x11. Please install x11-repo.

apt install x11-repo && apt update && apt install opencv

Ar57m commented 4 months ago

opencv has been removed from main to x11. Please install x11-repo.

apt install x11-repo && apt update && apt install opencv

thanks now it's working fine šŸ¤—

Ar57m commented 4 months ago

@licy183 btw sorry to bother you, I've been trying to create a video with pngs using imageio.v2, but ffmpeg keeps giving me this error, do you know how to fix it?

CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/bin/ffmpeg": cannot locate symbol "EVP_MD_CTX_init" referenced by "/system/lib64/libsqlite.so"...
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/imageio_ffmpeg/_io.py", line 627, in write_frames
    p.stdin.write(bb)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/home/man/another_fractal_generator/runner.py", line 371, in <module>
    writer.append_data(image)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/imageio/core/format.py", line 590, in append_data
    return self._append_data(im, total_meta)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/imageio/plugins/ffmpeg.py", line 600, in _append_data
    self._write_gen.send(im)
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/imageio_ffmpeg/_io.py", line 634, in write_frames
    raise IOError(msg)
OSError: [Errno 32] Broken pipe

FFMPEG COMMAND:
/data/data/com.termux/files/usr/bin/ffmpeg -y -f rawvideo -vcodec rawvideo -s 1600x1600 -pix_fmt rgb24 -r 10.00 -i - -an -vcodec libx264 -pix_fmt yuv420p -v warning /data/data/com.termux/files/home/man/another_fractal_generator/output.mp4

FFMPEG STDERR OUTPUT:
licy183 commented 4 months ago

Try installing libandroid-stub. apt install libandroid-stub

Ar57m commented 4 months ago

Try installing libandroid-stub. apt install libandroid-stub

thanks again šŸ™