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

"ValueError: invalid literal for int" in pip_install #468

Closed
JuliHof opened this issue Mar 24, 2021 · 7 comments
Closed

"ValueError: invalid literal for int" in pip_install #468

JuliHof opened this issue Mar 24, 2021 · 7 comments
Labels

Comments

@JuliHof
Copy link

JuliHof commented Mar 24, 2021

Chaquopy version

9.1.0

Relevant parts of your build.gradle file

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

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'

        python {

            pip {
                install "numpy"
                install "scipy"
            }

        }

        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
        }
    }

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

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation 'org.tensorflow:tensorflow-lite:2.3.0'
    implementation 'org.tensorflow:tensorflow-lite-gpu:2.3.0'
    implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'

    implementation 'org.apache.commons:commons-math3:3.6.1'
}

Describe your issue

When building my app the task generateDebugPythonRequirements fails because of a problem in generated/python/bp.zip/chaquopy/pip_install.py

Strange thing is: I developed the lib using chaquopy before in a test app (everything worked). Now when mating with productive app this error occures.

complete build log:

Executing tasks: [:app:assembleDebug] in project /home/julian/AppDev/monikit_mated/monikitAndroid

> Task :alarm:preBuild UP-TO-DATE
> Task :alarm:preDebugBuild UP-TO-DATE
> Task :core:preBuild UP-TO-DATE
> Task :core:preDebugBuild UP-TO-DATE
> Task :core:compileDebugAidl NO-SOURCE
> Task :persistence:preBuild UP-TO-DATE
> Task :persistence:preDebugBuild UP-TO-DATE
> Task :persistence:compileDebugAidl NO-SOURCE
> Task :remote:preBuild UP-TO-DATE
> Task :remote:preDebugBuild UP-TO-DATE
> Task :remote:compileDebugAidl NO-SOURCE
> Task :alarm:compileDebugAidl NO-SOURCE
> Task :core:packageDebugRenderscript NO-SOURCE
> Task :persistence:packageDebugRenderscript NO-SOURCE
> Task :remote:packageDebugRenderscript NO-SOURCE
> Task :alarm:compileDebugRenderscript NO-SOURCE
> Task :core:dataBindingMergeDependencyArtifactsDebug UP-TO-DATE
> Task :core:dataBindingMergeGenClassesDebug UP-TO-DATE
> Task :core:compileDebugRenderscript NO-SOURCE
> Task :core:generateDebugResValues UP-TO-DATE
> Task :core:generateDebugResources UP-TO-DATE
> Task :core:packageDebugResources UP-TO-DATE
> Task :core:dataBindingGenBaseClassesDebug UP-TO-DATE
> Task :core:parseDebugLocalResources UP-TO-DATE
> Task :core:processDebugManifest UP-TO-DATE
> Task :core:generateDebugRFile UP-TO-DATE
> Task :core:dataBindingTriggerDebug UP-TO-DATE
> Task :core:generateDebugBuildConfig UP-TO-DATE
> Task :core:kaptGenerateStubsDebugKotlin
> Task :alarm:dataBindingMergeGenClassesDebug UP-TO-DATE
> Task :alarm:generateDebugResValues UP-TO-DATE
> Task :alarm:generateDebugResources UP-TO-DATE
> Task :alarm:packageDebugResources UP-TO-DATE
> Task :alarm:dataBindingTriggerDebug UP-TO-DATE
> Task :alarm:generateDebugBuildConfig UP-TO-DATE
> Task :alarm:parseDebugLocalResources UP-TO-DATE
> Task :alarm:processDebugManifest UP-TO-DATE
> Task :persistence:compileDebugRenderscript NO-SOURCE
> Task :persistence:generateDebugResValues UP-TO-DATE
> Task :persistence:generateDebugResources UP-TO-DATE
> Task :persistence:packageDebugResources UP-TO-DATE
> Task :persistence:parseDebugLocalResources UP-TO-DATE
> Task :persistence:processDebugManifest UP-TO-DATE
> Task :remote:compileDebugRenderscript NO-SOURCE
> Task :remote:generateDebugResValues UP-TO-DATE
> Task :remote:generateDebugResources UP-TO-DATE
> Task :remote:packageDebugResources UP-TO-DATE
> Task :remote:parseDebugLocalResources UP-TO-DATE
> Task :remote:processDebugManifest UP-TO-DATE
> Task :core:javaPreCompileDebug UP-TO-DATE
> Task :persistence:generateDebugBuildConfig UP-TO-DATE
> Task :persistence:javaPreCompileDebug UP-TO-DATE
> Task :remote:generateDebugBuildConfig UP-TO-DATE
> Task :remote:javaPreCompileDebug UP-TO-DATE
> Task :alarm:javaPreCompileDebug UP-TO-DATE
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :auth:preBuild UP-TO-DATE
> Task :auth:preDebugBuild UP-TO-DATE
> Task :auth:compileDebugAidl NO-SOURCE
> Task :detection:preBuild UP-TO-DATE
> Task :detection:preDebugBuild UP-TO-DATE
> Task :algo:lib:preBuild UP-TO-DATE
> Task :algo:lib:preDebugBuild UP-TO-DATE
> Task :algo:lib:compileDebugAidl NO-SOURCE
> Task :detection:compileDebugAidl NO-SOURCE
> Task :diary:preBuild UP-TO-DATE
> Task :diary:preDebugBuild UP-TO-DATE
> Task :diary:compileDebugAidl NO-SOURCE
> Task :images:preBuild UP-TO-DATE
> Task :images:preDebugBuild UP-TO-DATE
> Task :images:compileDebugAidl NO-SOURCE
> Task :monitoring:preBuild UP-TO-DATE
> Task :monitoring:preDebugBuild UP-TO-DATE
> Task :monitoring:compileDebugAidl NO-SOURCE
> Task :push:preBuild UP-TO-DATE
> Task :push:preDebugBuild UP-TO-DATE
> Task :push:compileDebugAidl NO-SOURCE
> Task :sensor:preBuild UP-TO-DATE
> Task :sensor:preDebugBuild UP-TO-DATE
> Task :sensor:compileDebugAidl NO-SOURCE
> Task :sensormanagement:preBuild UP-TO-DATE
> Task :sensormanagement:preDebugBuild UP-TO-DATE
> Task :sensormanagement:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :alarm:packageDebugRenderscript NO-SOURCE
> Task :auth:packageDebugRenderscript NO-SOURCE
> Task :detection:packageDebugRenderscript NO-SOURCE
> Task :diary:packageDebugRenderscript NO-SOURCE
> Task :images:packageDebugRenderscript NO-SOURCE
> Task :monitoring:packageDebugRenderscript NO-SOURCE
> Task :push:packageDebugRenderscript NO-SOURCE
> Task :sensor:packageDebugRenderscript NO-SOURCE
> Task :sensormanagement:packageDebugRenderscript NO-SOURCE
> Task :algo:lib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :auth:dataBindingMergeGenClassesDebug UP-TO-DATE
> Task :auth:compileDebugRenderscript NO-SOURCE
> Task :auth:generateDebugResValues UP-TO-DATE
> Task :auth:generateDebugResources UP-TO-DATE
> Task :auth:packageDebugResources
> Task :persistence:generateDebugRFile
> Task :auth:dataBindingTriggerDebug
> Task :auth:generateDebugBuildConfig
> Task :diary:dataBindingMergeGenClassesDebug FROM-CACHE
> Task :diary:compileDebugRenderscript NO-SOURCE
> Task :diary:generateDebugResValues FROM-CACHE
> Task :diary:generateDebugResources UP-TO-DATE
> Task :diary:packageDebugResources
> Task :core:kaptDebugKotlin
> Task :auth:processDebugManifest

> Task :core:compileDebugKotlin
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/DurationPickerDialogFragment.kt: (45, 67): Parameter 'i' is never used, could be renamed to _
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/DurationPickerDialogFragment.kt: (46, 54): Parameter 'dialogInterface' is never used, could be renamed to _
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/DurationPickerDialogFragment.kt: (46, 71): Parameter 'i' is never used, could be renamed to _
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/MonikitAlertDialogFragment.kt: (54, 40): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/MonikitAlertDialogFragment.kt: (55, 40): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/MonikitProgressDialogFragment.kt: (44, 40): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java
w: /home/julian/AppDev/monikit_mated/monikitAndroid/core/src/main/java/com/monikit/android/core/dialogs/MonikitProgressDialogFragment.kt: (45, 40): 'FLAG_FULLSCREEN: Int' is deprecated. Deprecated in Java

> Task :core:compileDebugJavaWithJavac
> Task :alarm:dataBindingMergeDependencyArtifactsDebug
> Task :alarm:dataBindingGenBaseClassesDebug
> Task :auth:dataBindingMergeDependencyArtifactsDebug FROM-CACHE
> Task :auth:dataBindingGenBaseClassesDebug
> Task :diary:dataBindingMergeDependencyArtifactsDebug FROM-CACHE
> Task :diary:dataBindingGenBaseClassesDebug
> Task :diary:dataBindingTriggerDebug
> Task :diary:generateDebugBuildConfig
> Task :monitoring:dataBindingMergeDependencyArtifactsDebug FROM-CACHE
> Task :monitoring:dataBindingMergeGenClassesDebug FROM-CACHE
> Task :monitoring:compileDebugRenderscript NO-SOURCE
> Task :monitoring:generateDebugResValues FROM-CACHE
> Task :monitoring:generateDebugResources UP-TO-DATE
> Task :monitoring:packageDebugResources
> Task :monitoring:dataBindingGenBaseClassesDebug
> Task :diary:processDebugManifest
> Task :monitoring:dataBindingTriggerDebug
> Task :monitoring:generateDebugBuildConfig
> Task :detection:compileDebugRenderscript NO-SOURCE
> Task :detection:generateDebugBuildConfig
> Task :detection:generateDebugResValues FROM-CACHE
> Task :detection:generateDebugResources UP-TO-DATE
> Task :detection:packageDebugResources
> Task :monitoring:parseDebugLocalResources
> Task :algo:lib:compileDebugRenderscript NO-SOURCE
> Task :algo:lib:generateDebugResValues FROM-CACHE
> Task :algo:lib:generateDebugResources UP-TO-DATE
> Task :algo:lib:packageDebugResources FROM-CACHE
> Task :algo:lib:parseDebugLocalResources FROM-CACHE
> Task :algo:lib:generateDebugBuildConfig
> Task :algo:lib:extractPythonBuildPackages

> Task :algo:lib:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting numpy
  Using version 1.17.4 (newest version is 1.20.1, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/numpy/numpy-1.17.4-3-cp38-cp38-android_21_arm64_v8a.whl
Collecting scipy
  Using version 1.4.1 (newest version is 1.6.1, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/scipy/scipy-1.4.1-0-cp38-cp38-android_21_arm64_v8a.whl
Collecting chaquopy-openblas>=0.2.20 (from numpy)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_21_arm64_v8a.whl
Collecting chaquopy-libcxx>=7000 (from scipy)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-7000-2-py3-none-android_21_arm64_v8a.whl
Collecting chaquopy-libgfortran>=4.9 (from scipy)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_21_arm64_v8a.whl
Installing collected packages: chaquopy-libgfortran, chaquopy-openblas, numpy, chaquopy-libcxx, scipy
Successfully installed chaquopy-libcxx-7000 chaquopy-libgfortran-4.9 chaquopy-openblas-0.2.20 numpy-1.17.4 scipy-1.4.1
Chaquopy: Failed to process /home/julian/AppDev/monikit_mated/MoniAlgo/lib/build/pip/debug/arm64-v8a/chaquopy_libcxx-7000.dist-info
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/julian/AppDev/monikit_mated/monikitAndroid/algo/lib/build/generated/python/bp.zip/chaquopy/pip_install.py", line 354, in <module>
  File "/home/julian/AppDev/monikit_mated/monikitAndroid/algo/lib/build/generated/python/bp.zip/chaquopy/pip_install.py", line 67, in main
  File "/home/julian/AppDev/monikit_mated/monikitAndroid/algo/lib/build/generated/python/bp.zip/chaquopy/pip_install.py", line 159, in pip_install
ValueError: invalid literal for int() with base 10: ''

> Task :algo:lib:generateDebugPythonRequirements FAILED
> Task :algo:lib:processDebugManifest
> Task :detection:processDebugManifest
> Task :detection:parseDebugLocalResources
> Task :monitoring:processDebugManifest
> Task :auth:parseDebugLocalResources
> Task :core:bundleLibCompileToJarDebug
> Task :diary:parseDebugLocalResources
> Task :remote:generateDebugRFile

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':algo:lib:generateDebugPythonRequirements'.
> Process 'command 'python3.8'' finished with non-zero exit value 1
  
  To view full details in Android Studio:
  * In version 3.6 and newer, click the 'Build: failed' caption to the left of this message.
  * In version 3.5 and older, click the 'Toggle view' button 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 16s
79 actionable tasks: 35 executed, 11 from cache, 33 up-to-date

@mhsmith mhsmith changed the title generateDebugPythonRequirements failed "ValueError: invalid literal for int" in pip_install Mar 24, 2021
@mhsmith
Copy link
Member

mhsmith commented Mar 24, 2021

I think it's probably something to do with the difference between monikit_mated/MoniAlgo/lib and monikit_mated/monikitAndroid/algo/lib. Which of those directories contains the build.gradle file you posted?

Can you also post your settings.gradle file and your top-level build.gradle file? I guess they're both in monikit_mated, but please let me know if they're somewhere else.

@mhsmith mhsmith added the bug label Mar 24, 2021
@mhsmith
Copy link
Member

mhsmith commented Mar 25, 2021

Which of those directories contains the build.gradle file you posted?

And do you have any idea why both of them might be appearing? For example, did you rearrange your directory structure at some point, and if so how?

@JuliHof
Copy link
Author

JuliHof commented Mar 26, 2021

Which of those directories contains the build.gradle file you posted?

And do you have any idea why both of them might be appearing? For example, did you rearrange your directory structure at some point, and if so how?

You directly spotted the root cause. When mating development and productive app I made some mistakes. Fixing the directory structure also fixed the problem and everything runs. Thank you very much for your help :-)

@mhsmith
Copy link
Member

mhsmith commented Mar 26, 2021

That's great, thanks for letting me know. But to be honest, I'm still mystified about how this error is even possible. Could you explain specifically what was the mistake and how you fixed it, so I can help other users with the same problem?

@JuliHof
Copy link
Author

JuliHof commented Mar 29, 2021

I can try but it's hard to reconstruct.

  1. Productive App project is monikitAndroid. One sub module is "algo" which came from another app (MoniAlgo). Because it was easy and worked, I linked the path monikitAndroid/algo to the external MoniAlgo folder. This worked fine before we used chaquopy.
  2. I integrated chaquopy in MoniAlgo and still everything worked there
  3. Now building productive App crashed with the above error
  4. I updated settings.gradle from monikitAndroid. I changed include ':algo:lib' to include ':algo' and added project(":algo").projectDir = file("../MoniAlgo/lib")

@mhsmith
Copy link
Member

mhsmith commented Mar 31, 2021

Thanks, I've reproduced the problem. It looks like Chaquopy has a bug when a project path includes a symlink. We'll fix this in the next update.

@mhsmith
Copy link
Member

mhsmith commented Sep 22, 2021

This issue is fixed in Chaquopy 10.0.1. To upgrade, edit your app's top-level build.gradle file and change the version number of com.chaquo.python:gradle.

@mhsmith mhsmith closed this as completed Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants