chaquo/chaquopy

Could not find a version that satisfies the requirement pytubefix

MehdiSekoba opened this issue · 4 comments

Project Setup:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.ksp.plugin)
    alias(libs.plugins.hilt.plugin)
    alias(libs.plugins.safeargs.plugin)
    alias(libs.plugins.google.services)
    id("com.chaquo.python")
}

android {
    namespace = ""
    compileSdk = 34

    defaultConfig {
        applicationId = ""
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        
        ndk {
            abiFilters += listOf("arm64-v8a", "x86_64", "x86")
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }

    flavorDimensions += "pyVersion"
}

chaquopy {
    defaultConfig {
        buildPython("C:/Users/m2/AppData/Local/Programs/Python/Python312/python.exe")
        pip {
            install("pytubefix")
        }
    }
    sourceSets {
        getByName("main") {
            srcDir("src/main/python")
        }
    }
}
plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
    alias(libs.plugins.ksp.plugin) apply false
    alias(libs.plugins.hilt.plugin) apply false
    alias(libs.plugins.safeargs.plugin) apply false
    alias(libs.plugins.google.services) apply false
    id("com.chaquo.python") version "16.0.0" apply false

}

I'm encountering an issue with Chaquopy where I'm unable to install any Python libraries. Specifically, when trying to install the library pytubefix, I get the following error message:

Could not find a version that satisfies the requirement pytubefix (from versions: none)

I am using the latest version of the Kotlin plugin, Kotlin 2.0.20, and I’ve ensured that I am working with the latest versions of all my libraries. Despite this, the error persists. Below is my current build.gradle.kts configuration:

pytubefix is a pure-Python library, so it should install without any problems. Most likely, pip has been unable to contact PyPI because of a problem with either your internet connection or your Python installation.

Try the following:

  • Remove the buildPython line from your build.gradle file.
  • Install Python from https://www.python.org/downloads/, and accept all the default settings. Choose the same Python version as your app – this currently defaults to Python 3.8, but you can change it as shown in the documentation.
  • Build your app again.

If that doesn't work, please post the FULL build log. You can display it by clicking the “Build: failed” caption to the left of the error.

If this is still a problem, please post the information requested above, and I'll reopen the issue.

I'm encountering a recurring issue where the first compilation of the project completes successfully, but on the second attempt, the same compilation error reappears. When I check Logcat, all required dependencies and configurations appear to be downloaded and installed as expected.

If you're getting a build error, please post the full build log. To display it, click the 'Build: failed' caption to the left of this message.

If you're getting a runtime error, please post the full exception traceback.