kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.35k stars 1.85k forks source link

Python version number must have subversion? cannot find Python-3.7.tgz #1941

Closed JohnBuckleyGitHub closed 11 months ago

JohnBuckleyGitHub commented 5 years ago

Versions

Description

Clean build failed with log below.

In my p4a requirements I had the following:

--requirements=android,python3==3.7,kivy,plyer,numpy,boto3,botocore,urllib3,python-dateutil,jmespath,s3transfer

This was failing as it could not download python from:

https://www.python.org/ftp/python/3.7/Python-3.7.tgz

to fix it needs to be python3==3.7.1 (or .0, .2, .3, etc.)

This was working earlier this year, and the failure may be due to a change in www.python.org.

What was strange is that in the log below, it looks like it is downloading 3.7.1 initially, but failing when applying something involving python3-libffi-openssl-sqlite3.

This was fixed when setting --requirements=android,python3==3.7.1

buildozer.spec

run directly from p4A

Command:

['sh', 'p4a_script.sh']

Logs

python copy_compile_script.py C GitHub bikeano  
file copy completed
script starting
Apk path is: /home/anon/GitHub/vsbike/
p4a command:

p4a apk --debug --version=2.4.16016 --dist_name=vxxxxe  --bootstrap sdl2  --requirements=android,python3==3.7,kivy,plyer,boto3,botocore,urllib3,python-dateutil,jmespath,s3transfer --arch armeabi-v7a --name VSbike  --package com.xx.xx --android_api=28 --permission WRITE_EXTERNAL_STORAGE --permission ACCESS_FINE_LOCATION  --permission INTERNET  --permission ACCESS_NETWORK_STATE  --permission RECORD_AUDIO --add-jar android_antlib-restricted_4-15-0.jar --add-jar channel.jar  --presplash XX_splash.jpg  --icon XX-Favicon-ExtraRounded.png  --orientation portrait  --wakelock --window --color=always --private .
['sh', 'p4a_script.sh']
[INFO]:    Recipe python3: version "3.7" requested
[WARNING]:   **** FUTURE BEHAVIOR CHANGE WARNING ****
[WARNING]: Your project appears to contain a setup.py file.
[WARNING]: Currently, these are ignored by default.
[WARNING]: This will CHANGE in an upcoming version!
[WARNING]: 
[WARNING]: To ensure your setup.py is ignored, please specify:
[WARNING]:     --ignore-setup-py
[WARNING]: 
[WARNING]: To enable what will some day be the default, specify:
[WARNING]:     --use-setup-py
[WARNING]: $ANDROIDNDKVER is deprecated and no longer necessary, the value you set is ignored
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument: 28
[INFO]:    Available Android APIs are (28)
[INFO]:    Requested API target 28 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/anon/Android/NDK
[INFO]:    Found NDK version 17c
[WARNING]: NDK API target was not set manually, using the default of 21 = min(android-api=28, default ndk-api=21)
[INFO]:    Found virtualenv at /home/anon/.local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found a single valid recipe set: [u'boto3', u'botocore', 'hostpython3', u'jmespath', 'libffi', 'openssl', u'plyer', u'python-dateutil', u's3transfer', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', u'urllib3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', u'android', u'kivy']
[INFO]:    The selected bootstrap is sdl2
[INFO]:    # Creating dist with sdl2 bootstrap
[INFO]:    Dist will have name vsbike and requirements (android, python3, kivy, plyer, boto3, botocore, urllib3, python-dateutil, jmespath, s3transfer)
[INFO]:    Dist contains the following requirements as recipes: ['hostpython3', 'libffi', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', u'android', u'kivy']
[INFO]:    Dist will also contain modules (urllib3, s3transfer, boto3, plyer, python-dateutil, jmespath, botocore) installed from pip
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Recipe build order is ['hostpython3', 'libffi', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'setuptools', 'six', 'pyjnius', u'android', u'kivy']
[INFO]:    The requirements (boto3, botocore, jmespath, plyer, python-dateutil, s3transfer, urllib3) were not found as recipes, they will be installed with pip.
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython3
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/hostpython3
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/hostpython3
[DEBUG]:   -> running basename https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[DEBUG]:    Python-3.7.1.tgz
[DEBUG]:   Downloading hostpython3 from https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[DEBUG]:   -> running rm -f .mark-Python-3.7.1.tgz
[INFO]:    Downloading hostpython3 from https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[DEBUG]:   -> running touch .mark-Python-3.7.1.tgz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading libffi
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/libffi
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/libffi
[DEBUG]:   -> running basename https://github.com/libffi/libffi/archive/v3.2.1.tar.gz
[DEBUG]:    v3.2.1.tar.gz
[DEBUG]:   Downloading libffi from https://github.com/libffi/libffi/archive/v3.2.1.tar.gz
[DEBUG]:   -> running rm -f .mark-v3.2.1.tar.gz
[INFO]:    Downloading libffi from https://github.com/libffi/libffi/archive/v3.2.1.tar.gz
[DEBUG]:   -> running touch .mark-v3.2.1.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading openssl
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/openssl
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/openssl
[DEBUG]:   -> running basename https://www.openssl.org/source/openssl-1.1.1.tar.gz
[DEBUG]:    openssl-1.1.1.tar.gz
[DEBUG]:   Downloading openssl from https://www.openssl.org/source/openssl-1.1.1.tar.gz
[DEBUG]:   -> running rm -f .mark-openssl-1.1.1.tar.gz
[INFO]:    Downloading openssl from https://www.openssl.org/source/openssl-1.1.1.tar.gz
[DEBUG]:   -> running touch .mark-openssl-1.1.1.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading sdl2_image
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/sdl2_image
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/sdl2_image
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[DEBUG]:    SDL2_image-2.0.4.tar.gz
[DEBUG]:   Downloading sdl2_image from https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[DEBUG]:   -> running rm -f .mark-SDL2_image-2.0.4.tar.gz
[INFO]:    Downloading sdl2_image from https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[DEBUG]:   -> running touch .mark-SDL2_image-2.0.4.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading sdl2_mixer
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/sdl2_mixer
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/sdl2_mixer
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[DEBUG]:    SDL2_mixer-2.0.4.tar.gz
[DEBUG]:   Downloading sdl2_mixer from https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[DEBUG]:   -> running rm -f .mark-SDL2_mixer-2.0.4.tar.gz
[INFO]:    Downloading sdl2_mixer from https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[DEBUG]:   -> running touch .mark-SDL2_mixer-2.0.4.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading sdl2_ttf
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/sdl2_ttf
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/sdl2_ttf
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[DEBUG]:    SDL2_ttf-2.0.14.tar.gz
[DEBUG]:   Downloading sdl2_ttf from https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[DEBUG]:   -> running rm -f .mark-SDL2_ttf-2.0.14.tar.gz
[INFO]:    Downloading sdl2_ttf from https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[DEBUG]:   -> running touch .mark-SDL2_ttf-2.0.14.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading sqlite3
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/sqlite3
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/sqlite3
[DEBUG]:   -> running basename https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[DEBUG]:    sqlite-amalgamation-3150100.zip
[DEBUG]:   Downloading sqlite3 from https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[DEBUG]:   -> running rm -f .mark-sqlite-amalgamation-3150100.zip
[INFO]:    Downloading sqlite3 from https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[DEBUG]:   -> running touch .mark-sqlite-amalgamation-3150100.zip
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading python3
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/python3
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/python3
[DEBUG]:   -> running basename https://www.python.org/ftp/python/3.7/Python-3.7.tgz
[DEBUG]:    Python-3.7.tgz
[DEBUG]:   Downloading python3 from https://www.python.org/ftp/python/3.7/Python-3.7.tgz
[DEBUG]:   -> running rm -f .mark-Python-3.7.tgz
[INFO]:    Downloading python3 from https://www.python.org/ftp/python/3.7/Python-3.7.tgz
[DEBUG]:   -> running touch .mark-Python-3.7.tgz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading sdl2
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/sdl2
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/sdl2
[DEBUG]:   -> running basename https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
[DEBUG]:    SDL2-2.0.9.tar.gz
[DEBUG]:   Downloading sdl2 from https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
[DEBUG]:   -> running rm -f .mark-SDL2-2.0.9.tar.gz
[INFO]:    Downloading sdl2 from https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
[DEBUG]:   -> running touch .mark-SDL2-2.0.9.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading setuptools
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/setuptools
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/setuptools
[DEBUG]:   -> running basename https://pypi.python.org/packages/source/s/setuptools/setuptools-40.9.0.zip
[DEBUG]:    setuptools-40.9.0.zip
[DEBUG]:   Downloading setuptools from https://pypi.python.org/packages/source/s/setuptools/setuptools-40.9.0.zip
[DEBUG]:   -> running rm -f .mark-setuptools-40.9.0.zip
[INFO]:    Downloading setuptools from https://pypi.python.org/packages/source/s/setuptools/setuptools-40.9.0.zip
[DEBUG]:   -> running touch .mark-setuptools-40.9.0.zip
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading six
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/six
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/six
[DEBUG]:   -> running basename https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
[DEBUG]:    six-1.10.0.tar.gz
[DEBUG]:   Downloading six from https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
[DEBUG]:   -> running rm -f .mark-six-1.10.0.tar.gz
[INFO]:    Downloading six from https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz
[DEBUG]:   -> running touch .mark-six-1.10.0.tar.gz
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading pyjnius
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/pyjnius
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/pyjnius
[DEBUG]:   -> running basename https://github.com/kivy/pyjnius/archive/6553ad4.zip
[DEBUG]:    6553ad4.zip
[DEBUG]:   Downloading pyjnius from https://github.com/kivy/pyjnius/archive/6553ad4.zip
[DEBUG]:   -> running rm -f .mark-6553ad4.zip
[INFO]:    Downloading pyjnius from https://github.com/kivy/pyjnius/archive/6553ad4.zip
[DEBUG]:   -> running touch .mark-6553ad4.zip
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Downloading android
[INFO]:    Skipping android download as no URL is set
[INFO]:    Downloading kivy
[DEBUG]:   -> running mkdir -p /home/anon/.local/share/python-for-android/packages/kivy
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/packages/kivy
[DEBUG]:   -> running basename https://github.com/kivy/kivy/archive/1.11.1.zip
[DEBUG]:    1.11.1.zip
[DEBUG]:   Downloading kivy from https://github.com/kivy/kivy/archive/1.11.1.zip
[DEBUG]:   -> running rm -f .mark-1.11.1.zip
[INFO]:    Downloading kivy from https://github.com/kivy/kivy/archive/1.11.1.zip
[DEBUG]:   -> running touch .mark-1.11.1.zip
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    Unpacking hostpython3 for armeabi-v7a
[DEBUG]:   -> running basename https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[DEBUG]:    Python-3.7.1.tgz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/other_builds/hostpython3/desktop
[DEBUG]:   -> running mv Python-3.7.1 /home/anon/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking libffi for armeabi-v7a
[DEBUG]:   -> running basename https://github.com/libffi/libffi/archive/v3.2.1.tar.gz
[DEBUG]:    v3.2.1.tar.gz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_21
[DEBUG]:   -> running mv libffi-3.2.1 /home/anon/.local/share/python-for-android/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking openssl for armeabi-v7a
[DEBUG]:   -> running basename https://www.openssl.org/source/openssl-1.1.1.tar.gz
[DEBUG]:    openssl-1.1.1.tar.gz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/other_builds/openssl/armeabi-v7a__ndk_target_21
[DEBUG]:   -> running mv openssl-1.1.1 /home/anon/.local/share/python-for-android/build/other_builds/openssl/armeabi-v7a__ndk_target_21/openssl1.1
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking sdl2_image for armeabi-v7a
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[DEBUG]:    SDL2_image-2.0.4.tar.gz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni
[DEBUG]:   -> running mv SDL2_image-2.0.4 /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni/SDL2_image
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking sdl2_mixer for armeabi-v7a
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[DEBUG]:    SDL2_mixer-2.0.4.tar.gz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni
[DEBUG]:   -> running mv SDL2_mixer-2.0.4 /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni/SDL2_mixer
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking sdl2_ttf for armeabi-v7a
[DEBUG]:   -> running basename https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[DEBUG]:    SDL2_ttf-2.0.14.tar.gz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni
[DEBUG]:   -> running mv SDL2_ttf-2.0.14 /home/anon/.local/share/python-for-android/build/bootstrap_builds/sdl2-python3/jni/SDL2_ttf
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking sqlite3 for armeabi-v7a
[DEBUG]:   -> running basename https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[DEBUG]:    sqlite-amalgamation-3150100.zip
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/other_builds/sqlite3/armeabi-v7a__ndk_target_21
[DEBUG]:   -> running mv sqlite-amalgamation-3150100 /home/anon/.local/share/python-for-android/build/other_builds/sqlite3/armeabi-v7a__ndk_target_21/sqlite3
[INFO]:    <- directory context /home/anon/GitHub/vsbike
[INFO]:    Unpacking python3 for armeabi-v7a
[DEBUG]:   -> running basename https://www.python.org/ftp/python/3.7/Python-3.7.tgz
[DEBUG]:    Python-3.7.tgz
[INFO]:    -> directory context /home/anon/.local/share/python-for-android/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21
Traceback (most recent call last):
  File "/home/anon/.local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==2019.7.8.1.dev0', 'console_scripts', 'p4a')()
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 1192, in main
    ToolchainCL()
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 666, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 152, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 205, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/build.py", line 565, in build_recipes
    recipe.prepare_build_dir(arch.arch)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/recipe.py", line 510, in prepare_build_dir
    self.unpack(arch)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/recipe.py", line 409, in unpack
    sh.tar('xf', extraction_filename)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

  RAN: /bin/tar xf /home/anon/.local/share/python-for-android/packages/python3/Python-3.7.tgz

  STDOUT:

  STDERR:
/bin/tar: This does not look like a tar archive

gzip: stdin: not in gzip format
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
AndreMiras commented 5 years ago

Yes indeed the version should be matching with what's on the download site. However p4a is definitely misbehaving in one way as it should fail earlier with a 404. Let's fix that, PR are welcome :smile:

AndreMiras commented 5 years ago

I just gave it a try and for me it does fail fast so I was a bit confused :thinking:

[INFO]:    Downloading python3                       
[INFO]:    -> running mkdir -p /home/andre/workspace/EtherollApp/.buildozer/android/platform/build/packages/python3
[INFO]:    -> directory context /home/andre/workspace/EtherollApp/.buildozer/android/platform/build/packages/python3
[INFO]:    -> running basename https://www.python.org/ftp/python/3.7/Python-3.7.tgz                                                                                                                                                                                                      
[INFO]:    -> running rm -f .mark-Python-3.7.tgz                                                                                                                                                                                                                                         
[INFO]:    Downloading python3 from https://www.python.org/ftp/python/3.7/Python-3.7.tgz                                                                                                                                                                                                
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)                     
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code                                                                                                                                                                                                                              
    exec(code, run_globals)                                                                                                                                                                                                                                                              
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1189, in <module>
    main()                                                                                                                                                                                                                                                                               
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1183, in main
    ToolchainCL()                                                                                                                                                                                                                                                                        
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 666, in __init__                                                                                                                                  
    getattr(self, args.subparser_name.replace('-', '_'))(args)                                                                         
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 152, in wrapper_func
    build_dist_from_args(ctx, dist, args)                                                                                                                                                                                                                                                
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 205, in build_dist_from_args
    args, "ignore_setup_py", False                                                                                                                                                                                                                                                       
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 535, in build_recipes                                                                                                                                          
    recipe.download_if_necessary()
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 298, in download_if_necessary
    self.download()               
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 344, in download
    self.download_file(self.versioned_url, filename)                                                                    
  File "/home/andre/workspace/EtherollApp/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 159, in download_file
    urlretrieve(url, target, report_hook)               
  File "/usr/lib/python3.6/urllib/request.py", line 1819, in retrieve                                           
    block = fp.read(bs)      
  File "/usr/lib/python3.6/tempfile.py", line 624, in func_wrapper                                                
    return func(*args, **kwargs)                                                                                   
ValueError: read of closed file 

At the same time I remember this bug rings the bell. Then a realize you're running on Python2. So it might be behaving differently here. I'll dig further

JohnBuckleyGitHub commented 5 years ago

Actually this was on python3, I will give you my full p4a cmd line -

p4a apk --debug --version=2.4.16021 --dist_name=vsbike --bootstrap sdl2 --requirements=libffi,android,python3==3.7,kivy,plyer,numpy,boto3,botocore,urllib3,python-dateutil,jmespath,s3transfer --arch arm64-v8a --name VSbike --package com.vxxxe.vsbike --android_api=28 --permission WRITE_EXTERNAL_STORAGE --permission ACCESS_FINE_LOCATION --permission INTERNET --permission ACCESS_NETWORK_STATE --permission RECORD_AUDIO --add-jar android_antlib-restricted_4-15-0.jar --add-jar channel.jar --presplash Vxxxxe_splash.jpg --icon Vxxxxxe-Favicon-ExtraRounded.png --orientation portrait --wakelock --window --color=always --private .

I first found this while switching the build to arm64-v8a, which I thought was the cause, but it also happens with armeabi-v7a. I would happily do a PR, but I was not able to find where the code was failing other than correcting python3=3.7 to python3=3.7.1

AndreMiras commented 5 years ago

I'm talking about your host, from where you're running the command, it's python2. I ca tell from the trace:

Traceback (most recent call last):
  File "/home/anon/.local/bin/p4a", line 11, in <module>
    load_entry_point('python-for-android==2019.7.8.1.dev0', 'console_scripts', 'p4a')()
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 1192, in main
    ToolchainCL()
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 666, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 152, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 205, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/build.py", line 565, in build_recipes
    recipe.prepare_build_dir(arch.arch)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/recipe.py", line 510, in prepare_build_dir
    self.unpack(arch)
  File "/home/anon/.local/lib/python2.7/site-packages/pythonforandroid/recipe.py", line 409, in unpack
    sh.tar('xf', extraction_filename)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 1427, in __call__
    return RunningCommand(cmd, call_args, stdin, stdout, stderr)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 774, in __init__
    self.wait()
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 792, in wait
    self.handle_command_exit_code(exit_code)
  File "/home/anon/.local/lib/python2.7/site-packages/sh.py", line 815, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_2: 

See this part .local/lib/python2.7/site-packages/. Anyway I could indeed reproduce the problem in python2 and I have an idea why it fails. Basically we're using the FancyURLopener to download the archive. And this downloader is made to kinda fail silently FancyURLopener.http_error_default. This is I guess because it's made to try to recover from certains status codes such redirects. And to me Python3 is also misbehaving in a way as the message is not clear. Anyway before I work on a fix I'd like to unit test this part of the code further, which I've started doing in https://github.com/kivy/python-for-android/pull/1946. Oh and by the way this is also why sometimes pyjnius patching fails https://github.com/kivy/python-for-android/issues/1589

Julian-O commented 11 months ago

Closing, because apparently it only fails in Python 2, and we no longer support it.