chaquo / chaquopy

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

Build failed and Cmake Error when try to install ultralytics #1102

Closed rovedashcam closed 3 months ago

rovedashcam commented 4 months ago

Process 'command '/Users/cdp/AndroidStudioProjects/chaquopy-matplotlib/app/build/python/env/debug/bin/python'' finished with non-zero exit value 1 I am trying to read python code using Android kotlin code i am able to read simple sum code but some code which is read based on library so i am unable to read it

import json
import pandas as pd
from ultralytics import YOLO
model = YOLO("file:///android_asset/YoloV8_model.pt")
def detectOCR(imagePath):
    try:
        results = model(imagePath)
        df = pd.DataFrame(results[0].boxes.data)
        df.sort_values(by=[0], inplace=True)
        df.reset_index(inplace=True, drop=True)

        output = ""
        kwh = False
        names = results[0].names

        for i in range(len(df)):
            if names[int(df[5][i])] == "kwh":
                kwh = True
                continue
            output += names[int(df[5][i])]
        if kwh:
            output += " kwh"
        return json.dumps({"status": "success", "msg": "successfully processed", "result": output})
    except:
        return "error"

This is python code for this we need install ultralytics and pandas both library installed i install like using build.gradle file .

 python {
            version '3.8'
            pip {
              //  install "matplotlib"
                install "pandas"
          //      install "torch"
        //       install "YOLO"
                install "ultralytics"
            }
        }

please suggest me where i am doing wrong and what i am doing wrong .

Thanks

mhsmith commented 4 months ago

The error is:

ERROR: Failed to install opencv-python>=4.6.0 from https://files.pythonhosted.org/packages/c0/52/9fe76a56e01078a612812b40764a7b138f528b503f7653996c6cfadfa8ec/opencv-python-4.8.1.78.tar.gz#sha256=cc7adbbcd1112877a39274106cb2752e04984bc01a031162952e97450d6117f6 (from ultralytics).

The newest version of ultralytics which is compatible with our current opencv and numpy packages is:

            install "ultralytics==8.0.16"
            install "seaborn==0.12.2"

To be notified when we upgrade opencv, please subscribe to #620.

mhsmith commented 3 months ago

The rest of the conversation is unrelated to the original question, so I've moved it to #1106. Please continue there.