1

I am trying to install rembg python library using chaquopy in android studio but the following error occurs:

ERROR: Could not find a version that satisfies the requirement onnxruntime~=1.13.1 (from rembg) (from versions: none) ERROR: No matching distribution found for onnxruntime~=1.13.1 (from rembg) Chaquopy: Exit status 1

  1. This is my build.gradle file details:
plugins {
    id 'com.android.application'
    id 'com.chaquo.python'
}

android {
    namespace 'package.name'
    compileSdk 33

    defaultConfig {
        applicationId "package.name"
        minSdk 23
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }
        python {
            pip {
                install "rembg"
            }
            buildPython "C:/Users/Talha/AppData/Local/Programs/Python/Python38/python.exe"
        }
        sourceSets {
            main {
                python.srcDir "src/main/python"
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.0'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

This is gradle version: Gradle version details

using chaquo plugin:

id 'com.chaquo.python' version '13.0.0' apply false

I tried adding following install commands in pip tag:

pip {
     install "onnxruntime==1.12.1"
     install "rembg"
}
pip {
     install "onnxruntime==1.11.1"
     install "rembg"
}
pip {
     install "onnxruntime==1.10.1"
     install "rembg"
}

None of this success. I installed rembg from cmd it installed successfully and i have tested my code now i want to use in android studio and facing this issue

  • Unfortunately Chaquopy doesn't support any ONNX packages yet. For more details, see https://github.com/chaquo/chaquopy/issues/216. – mhsmith Jan 16 '23 at 19:08
  • @mhsmith Thanks for the help. Appreciated! Did you know about any other way or alternate of chaquopy that support it? – Talha Bilal Jan 17 '23 at 06:37
  • Unfortunately not: it's not in Kivy's [list of Android packages](https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/recipes) either. – mhsmith Jan 17 '23 at 12:03
  • However, Chaquopy does support TensorFlow Lite, so you might be able to use your model by converting it into that format. For details, see [here](https://github.com/chaquo/chaquopy/issues/216#issuecomment-1152179911). – mhsmith Jan 17 '23 at 12:05

0 Answers0