Closed JohnBuckleyGitHub closed 11 months 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:
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
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
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
Closing, because apparently it only fails in Python 2, and we no longer support it.
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:
Logs