Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TomlError when building with pybase64 #1229

Closed
MustafaErkinDal opened this issue Aug 14, 2024 · 1 comment
Closed

TomlError when building with pybase64 #1229

MustafaErkinDal opened this issue Aug 14, 2024 · 1 comment

Comments

@MustafaErkinDal
Copy link

MustafaErkinDal commented Aug 14, 2024

Hi,

I have been using this SDK for over a year in my Android project and suddenly it started to not build itself. I could not find any solution. I will be appreciated if you can help me. My python version on my macbook is 3.8.10

Thank you in advance.

My error:

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting opencv-python
  Using version 4.5.1.48 (newest version is 4.10.0.84, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/opencv-python/opencv_python-4.5.1.48-1-cp38-cp38-android_21_arm64_v8a.whl
Collecting numpy
  Using version 1.19.5 (newest version is 1.24.4, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/numpy/numpy-1.19.5-0-cp38-cp38-android_21_arm64_v8a.whl
Collecting pillow
  Using version 8.4.0 (newest version is 10.4.0, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/pillow/Pillow-8.4.0-0-cp38-cp38-android_21_arm64_v8a.whl
Collecting requests
  Using cached https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl
Collecting matplotlib
  Using version 3.1.2 (newest version is 3.7.5, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/matplotlib/matplotlib-3.1.2-1-cp38-cp38-android_21_arm64_v8a.whl
Collecting pybase64
  Using cached https://files.pythonhosted.org/packages/e9/3b/10fe20bd63304550914f077bac75710a7da9d668b9e9b5a74571dd0f4990/pybase64-1.4.0.tar.gz

STARTS HERE

ERROR: Exception:
Traceback (most recent call last):
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/cli/base_command.py", line 189, in main
    status = self.run(options, args)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/commands/install.py", line 348, in run
    resolver.resolve(requirement_set)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/legacy_resolve.py", line 196, in resolve
    self._resolve_one(requirement_set, req)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/legacy_resolve.py", line 359, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/legacy_resolve.py", line 305, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/operations/prepare.py", line 214, in prepare_linked_requirement
    abstract_dist.prepare_distribution_metadata(
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/distributions/source.py", line 30, in prepare_distribution_metadata
Exception:

    self.req.load_pyproject_toml()
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/req/req_install.py", line 502, in load_pyproject_toml
    pyproject_toml_data = load_pyproject_toml(
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_internal/pyproject.py", line 66, in load_pyproject_toml
    pp_toml = pytoml.load(f)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_vendor/pytoml/parser.py", line 11, in load
    return loads(fin.read(), translate=translate, object_pairs_hook=object_pairs_hook, filename=getattr(fin, 'name', repr(fin)))
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_vendor/pytoml/parser.py", line 24, in loads
    ast = _p_toml(src, object_pairs_hook=object_pairs_hook)
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_vendor/pytoml/parser.py", line 340, in _p_toml
    s.expect_eof()
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_vendor/pytoml/parser.py", line 125, in expect_eof
    return self._expect(self.consume_eof())
  File "/Users/mustafaerkindal/Desktop/analyzer s8 camerax backup/app/build/generated/python/bp.zip/pip/_vendor/pytoml/parser.py", line 165, in _expect
    raise TomlError('msg', self._pos[0], self._pos[1], self._filename)
pip._vendor.pytoml.core.TomlError: /private/var/folders/8f/h3q98nd921g88h8m3z6vvx940000gn/T/pip-install-x62xlho9/pybase64/pyproject.toml(95, 1): msg
Chaquopy: Exit status 2

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

My gradle.app:

plugins {
    id 'com.android.application'
    id 'com.chaquo.python'
}

android {
    compileSdk 32
    //33

    defaultConfig {
        applicationId "com.sdu.camerax"
        minSdk 29
        //33
        targetSdk 30
        //33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }
        python {
            buildPython "python3.8"
            pip{
                install "opencv-python"
                install "numpy"
                install "pillow"
                install "requests"
                install "matplotlib"
                install "pybase64"
            }
        }

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    externalNativeBuild {
        cmake {
            version "3.10.2"
            //path file('src/main/jni/CMakeLists.txt')
        }
    }
    sourceSets {
        main {
            python.srcDir "src/main/python"
        }
    }

    dexOptions {
        javaMaxHeapSize "4G"
    }
}



dependencies {
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
    implementation 'androidx.appcompat:appcompat:1.4.2'
    implementation 'com.squareup.okhttp3:okhttp:4.9.3'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.code.gson:gson:2.10'
    implementation project(path: ':opencv')
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    // cameraX
    implementation "androidx.camera:camera-core:1.1.0-alpha11"
    implementation "androidx.camera:camera-camera2:1.1.0-alpha11"
    implementation "androidx.camera:camera-lifecycle:1.1.0-alpha11"
    implementation "androidx.camera:camera-view:1.0.0-alpha31"
    implementation "androidx.camera:camera-extensions:1.0.0-alpha31"

    api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'


    //realsense
    implementation 'com.intel.realsense:librealsense:2.50.0@aar'

    //debugImplementation 'com.squareup.leakcanary:leakcanary-android:3.0-alpha-1'

}
@mhsmith
Copy link
Member

mhsmith commented Aug 15, 2024

Your pip section is currently set to use the newest possible version of each requirement, so your app may change whenever they make a new release. It would be a good idea to use the == syntax to pin them to a specific version. In particular, you can probably solve your current issue by using an older version of pybase64.

Alternatively, you could upgrade to a newer version of Chaquopy. From the "looking in indexes" line, your current version is apparently 13.0.0 or older. I believe this particular issue was fixed in version 14.0.2, but if possible I recommend you use the most recent version.

@mhsmith mhsmith changed the title Building Issue With Python 3.8 TomlError when building with pybase64 Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants