Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to install opencv-python on termux #732

Open
4 tasks done
Miniontoby opened this issue Sep 26, 2022 · 10 comments
Open
4 tasks done

Failed to install opencv-python on termux #732

Miniontoby opened this issue Sep 26, 2022 · 10 comments
Assignees
Labels

Comments

@Miniontoby
Copy link

Miniontoby commented Sep 26, 2022

Expected behaviour

A working installation using pip install opencv-python

Actual behaviour

Failed to install at cmake

Steps to reproduce

  • example code: Not needed
  • operating system: Termux on Android
  • architecture (e.g. x86): armv7l
  • opencv-python version: latest
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)

  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)

  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")

  • I'm using the latest version of opencv-python

Possibly helpful: scikit-build/cmake-python-distributions#223

@asmorkalov
Copy link
Collaborator

Could you bring more details, logs, etc?

@asmorkalov asmorkalov self-assigned this Sep 27, 2022
@Miniontoby
Copy link
Author

Miniontoby commented Sep 27, 2022 via email

@Miniontoby
Copy link
Author

Miniontoby commented Sep 29, 2022

The logs are the same as at this issue at the comment of "RSwarnkar"

@asmorkalov
Copy link
Collaborator

The issue is related to CMake tool, but not OpenCV. It fails to build with libarchive. At least it's what I see from logs in the related ticket. There is nothing to fix in OpenCV for now.
As hack or workaround you can do the following:

  • Install cmake from bre-built archive / package manager / build from sources with limited options.
  • Hack OpenCV-Python package and exclude cmake package from dependencies. System provided cmake should be used then.

@Miniontoby
Copy link
Author

Miniontoby commented Oct 1, 2022

Can you tell me how to 'hack' opencv-python to exclude the cmake package?

I know a lot, but cannot figure this one out yet

EDIT: I think i did it, but still it failed. Here is the logs: https://termbin.com/1gm1

@realyukii
Copy link

I managed to install it, but it not listed in pip list

pkg list-installed:

opencv-python/x11,now 4.10.0-2 aarch64 [installed]
opencv/x11,now 4.10.0-2 aarch64 [installed,automatic]

@realyukii
Copy link

nvm, the output of pkg list-installed is false-positive, and it didn't printed on apt list --installed or pkg files opencv-python

@realyukii
Copy link

after some update & upgrade and reinstall the package, somehow it now properly installed. even though it will not listed on pip list command, you can still use it. maybe the reason it didn't listed on pip because package naming convention? opencv-python instead of python-opencv make it invisible from pip? because I install python-numpy with pkg and it's listed as well on pip.

@ab2-g
Copy link

ab2-g commented Dec 17, 2024

Problem:

When trying to build OpenCV on Termux, the installation fails because CMake looks for Android SDK and Java tools, which are not available in Termux by default.

Solution:

To solve this issue, you can disable Android and Java support in CMake by using the following settings:

cmake -DANDROID=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_JAVA=OFF -DBUILD_FAT_JAVA_LIB=OFF -DWITH_OPENCL=OFF -DWITH_CUDA=OFF ..

This will allow OpenCV to be installed successfully in Termux without any issues related to missing Android SDK or Java.

Additional Details:

  • Operating System: Android (via Termux)
  • Architecture: ARM, x86, etc.
  • OpenCV Version: [mention the version you tested]

@asmorkalov
Copy link
Collaborator

asmorkalov commented Jan 13, 2025

#1063

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants