chaquo / chaquopy

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

greenlet for Python 3.9 or later #817

Closed proneon267 closed 2 weeks ago

proneon267 commented 1 year ago

Chaquopy version

com.chaquo.python:gradle:14.0.2

Relevant parts of your build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'com.chaquo.python'

android {
    // Android 13 == SDK Level 33. This number should generally be kept up to date with
    // the most recent supported Android release.
    compileSdkVersion 33

    defaultConfig {
        applicationId "com.example.beelapp"
        versionCode 100
        versionName "0.0.1"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        // Briefcase currently requires API Level 24 for the `pidof` command, and the `--pid`
        // argument to `adb logcat`. This supports over 90% of active devices
        // (https://github.com/beeware/rubicon-java/issues/74).
        minSdkVersion 24
        // This should gnerally match the compileSDKVersion from above.
        targetSdkVersion 33

        python {
            version "3.10"
            pip {
                install "-r", "requirements.txt"
            }
            extractPackages "tests"
        }
        ndk {
            // Chaquopy also supports x86, but it's not very useful anymore, so we'll
            // disable it to speed up the build. For armeabi-v7a, see
            // https://github.com/chaquo/chaquopy/issues/709.
            abiFilters "arm64-v8a", "armeabi-v7a", "x86_64"
        }
    }

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            python.srcDirs = [
                "src/main/python",  // App code
                "src/main/python-briefcase",  // Template code
            ]
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}

// ========== START USER PROVIDED CONTENT ==========

Describe your issue

I am using briefcase and while building, I am getting an error:

...
 copying src/greenlet/platform/switch_x64_msvc.h -> build/lib.linux-x86_64-3.10/greenlet/platform
  copying src/greenlet/platform/switch_x86_msvc.h -> build/lib.linux-x86_64-3.10/greenlet/platform
  copying src/greenlet/platform/switch_x86_unix.h -> build/lib.linux-x86_64-3.10/greenlet/platform
  running build_ext
  building 'greenlet._greenlet' extension
  error: CCompiler.compile: Chaquopy cannot compile native code
  ----------------------------------------
ERROR: Failed to install greenlet>=2.0.0; platform_python_implementation == "CPython" from https://files.pythonhosted.org/packages/1e/1e/632e55a04d732c8184201238d911207682b119c35cecbb9a573a6c566731/greenlet-2.0.2.tar.gz#sha256=e7c8dc13af7db097bed64a051d2dd49e9f0af495c26995c00a9ee842690d34c0 (from gevent->gevent-websocket->bottle-websocket->eel->-r requirements.txt (line 1)).
For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues.
Chaquopy: Exit status 1

> Task :app:generateDebugPythonRequirements FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugPythonRequirements'.
> Process 'command 'python3.10'' finished with non-zero exit value 1

  To view full details in Android Studio:
  * Click the 'Build: failed' caption to the left of this message.
  * Then scroll up to see the full output.

* 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.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 5s
3 actionable tasks: 3 executed
Building...

Error while building project.

more importantly

ERROR: Failed to install greenlet>=2.0.0; platform_python_implementation == "CPython" from https://files.pythonhosted.org/packages/1e/1e/632e55a04d732c8184201238d911207682b119c35cecbb9a573a6c566731/greenlet-2.0.2.tar.gz#sha256=e7c8dc13af7db097bed64a051d2dd49e9f0af495c26995c00a9ee842690d34c0
 (from gevent->gevent-websocket->bottle-websocket->eel->-r requirements.txt (line 1)).

The error shows greenlet is the causing the error. So, is it because greenlet is just not compatible or because of using python 3.10?

proneon267 commented 1 year ago

Closing as using python3.8 solves the error

mhsmith commented 1 year ago

This package is currently only available for Python 3.8. You can set your app’s Python version by following the instructions here. If switching to Python 3.8 doesn't work for you, please post a comment explaining why.

If you'd like to try building this package for another Python version, follow the instructions here. And if you're successful, please make a pull request so we can add the build to the public repository.

mhsmith commented 11 months ago

If anyone else needs this package for Python 3.9 or later, please click the thumbs up button above, and subscribe to this issue to receive updates.

mhsmith commented 2 weeks ago

greenlet version 3.0.1 is now available for Python 3.8 - 3.12.