chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
806 stars 132 forks source link

Failed to install opencv-contrib-python version 4.10.0.82 #1174

Closed Aksh-07 closed 3 months ago

Aksh-07 commented 3 months ago

Chaquopy version

14.0.2 #### Relevant parts of your build.gradle file

this is my android block in app's top level build.gradle:

android {
    compileSdkVersion 31
    buildToolsVersion "29.0.3"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.beeyen.avail"
        minSdkVersion 21
        targetSdkVersion 31
        versionCode 1
        versionName "1.0"

        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "x86", "x86_64", "arm64-v8a", "armeabi-v7a"
        }

        python {
            version "3.11"
//            buildPython "/home/aksh/Python-3.8.12/python"
            buildPython "/usr/bin/python3.11"
            pip {
                install "cython"
                install "requests"
                install "blinker==1.8.1"
                install "click==8.1.7"
                install "cloudevents==1.10.1"
                install "colorama==0.4.6"
                install "deprecation==2.1.0"
                install "Flask==3.0.3"
                install "functions-framework==3.5.0"
                install "itsdangerous==2.2.0"
                install "Jinja2==3.1.3"
                install "MarkupSafe==2.1.5"
                install "numpy"
                install "opencv-contrib-python"
//                install "opencv-python"
//                install "pyinstaller"
                install "packaging==24.0"
                install "watchdog==4.0.0"
                install "Werkzeug==3.0.2"
                install "puremagic"
            }
        }

    }

Describe your issue

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0, https://chaquo.com/pypi-13.1
Collecting cython
  Downloading Cython-3.0.10-py2.py3-none-any.whl (1.2 MB)
Collecting requests
  Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting blinker==1.8.1
  Using cached blinker-1.8.1-py3-none-any.whl (9.5 kB)
Collecting click==8.1.7
  Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting cloudevents==1.10.1
  Using cached cloudevents-1.10.1-py3-none-any.whl (55 kB)
Collecting colorama==0.4.6
  Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting deprecation==2.1.0
  Using cached deprecation-2.1.0-py2.py3-none-any.whl (11 kB)
Collecting Flask==3.0.3
  Using cached flask-3.0.3-py3-none-any.whl (101 kB)
Collecting functions-framework==3.5.0
  Using cached functions_framework-3.5.0-py3-none-any.whl (32 kB)
Collecting itsdangerous==2.2.0
  Using cached itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Collecting Jinja2==3.1.3
  Using cached Jinja2-3.1.3-py3-none-any.whl (133 kB)
Processing /home/aksh/.cache/chaquopy/pip/wheels/6d/eb/a5/82b178b683b6dc068c2eb7b38fc35ebc7ea378b5faad3d1326/MarkupSafe-2.1.5-py3-none-any.whl
Collecting numpy
  Using cached https://chaquo.com/pypi-13.1/numpy/numpy-1.26.2-0-cp311-cp311-android_21_arm64_v8a.whl (5.0 MB)
Collecting opencv-contrib-python
  Using cached opencv-contrib-python-4.10.0.82.tar.gz (150.4 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Collecting packaging==24.0
  Using cached packaging-24.0-py3-none-any.whl (53 kB)
Processing /home/aksh/.cache/chaquopy/pip/wheels/d2/2f/30/4d285b2bca3200c01738b5fa7842f7d7a463200f53bb69a45a/watchdog-4.0.0-py3-none-any.whl
Collecting Werkzeug==3.0.2
  Using cached werkzeug-3.0.2-py3-none-any.whl (226 kB)
Collecting puremagic
  Using cached puremagic-1.23-py3-none-any.whl (37 kB)
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.3.2-py3-none-any.whl (48 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.7-py3-none-any.whl (66 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2024.6.2-py3-none-any.whl (164 kB)
Collecting gunicorn>=19.2.0; platform_system != "Windows"
  Using cached gunicorn-22.0.0-py3-none-any.whl (84 kB)
Collecting chaquopy-libcxx>=11000
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-11000-0-py3-none-android_21_arm64_v8a.whl (308 kB)
Collecting chaquopy-openblas>=0.2.20
  Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_21_arm64_v8a.whl (4.3 MB)
Collecting chaquopy-libgfortran>=4.9
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_21_arm64_v8a.whl (495 kB)
Building wheels for collected packages: opencv-contrib-python
  Building wheel for opencv-contrib-python (PEP 517): started
  Building wheel for opencv-contrib-python (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.11 /home/aksh/Downloads/SmartNest-Demo-2/app/build/generated/python/bp/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp05hpnuwf
       cwd: /tmp/pip-install-je10qfiq/opencv-contrib-python
  Complete output (96 lines):

  --------------------------------------------------------------------------------
  -- Trying 'Ninja' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  Not searching for unused variables given on the command line.

  CMake Error at /tmp/pip-build-env-vg27h9h0/overlay/lib/python3.11/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCCompiler.cmake:49 (message):
    Could not find compiler set in environment variable CC:
  ERROR: Command errored out with exit status 1:

    Chaquopy_cannot_compile_native_code.
  Call Stack (most recent call first):
    CMakeLists.txt:3 (ENABLE_LANGUAGE)

  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Ninja' generator - failure
  --------------------------------------------------------------------------------

  --------------------------------------------------------------------------------
  -- Trying 'Unix Makefiles' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  Not searching for unused variables given on the command line.

  CMake Error at /tmp/pip-build-env-vg27h9h0/overlay/lib/python3.11/site-packages/cmake/data/share/cmake-3.29/Modules/CMakeDetermineCCompiler.cmake:49 (message):
    Could not find compiler set in environment variable CC:

    Chaquopy_cannot_compile_native_code.
  Call Stack (most recent call first):
    CMakeLists.txt:3 (ENABLE_LANGUAGE)

  CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Unix Makefiles' generator - failure
  --------------------------------------------------------------------------------

                  ********************************************************************************
                  scikit-build could not get a working generator for your system. Aborting build.

                  Building Linux wheels for Python 3.11 requires a compiler (e.g gcc).
  But scikit-build does *NOT* know how to install it on ubuntu

  To build compliant wheels, consider using the manylinux system described in PEP-513.
  Get it with "dockcross/manylinux-x64" docker image:

    https://github.com/dockcross/dockcross#readme

  For more details, please refer to scikit-build documentation:

    http://scikit-build.readthedocs.io/en/latest/generators.html#linux

                  ********************************************************************************
  ----------------------------------------
ERROR: Failed to install opencv-contrib-python from https://files.pythonhosted.org/packages/1e/1c/40589fea3bc1b996c9cc2d1685fc78db0986e6a6e06221798dfb37afa37a/opencv-contrib-python-4.10.0.82.tar.gz#sha256=5ff1d7be59f53f0fefb60f92d31ba3a4287a82e304d55ed0d37759100447d991.
For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues.
Chaquopy: Exit status 1

> Task :app:generateDebugPythonRequirements FAILED
Execution failed for task ':app:generateDebugPythonRequirements'.
> Process 'command '/usr/bin/python3.11'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

i want to use opencv version > 4.5.4, and in chaquopy with python version 3.8, opencv version 4.5.1 is working, but I see no wheels for newer version, so is it possible for me to use opencv versions > 4.5.4 in my python script

mhsmith commented 3 months ago

See #620, and please post a comment there explaining why you need the new opencv version.