question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting p4a.source_dir in buildozer causes AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

See original GitHub issue

Versions

  • Python: 3.7.5
  • OS: Linux
  • Kivy: 1.11.1
  • Cython: 0.29.16

Description

Setting a custom p4a source dir using a freshly cloned ‘develop’ branch and then building an APK results in a traceback mentioning an AttributeError:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1231, in <module>
    main()
  File "/home/zedr/src/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 688, in __init__
    getattr(self, command)(args)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    func(self, args, **kw)
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1099, in apk
    output, build_args = self._build_package(args, package_type='apk')
  File "/home/zedr/src/python-for-android/pythonforandroid/toolchain.py", line 1000, in _build_package
    build_args = build.parse_args_and_make_package(
AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

The error does not occur if I use the master branch instead.

buildozer.spec

Command:

python3.7 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name letter_trail --name 'Letter Trail' --version 0.1.0 --package com.zedr.games.letter_trail --minsdk 21 --ndk-api 21 --private /home/zedr/src/trail/.buildozer/android/app --permission INTERNET --permission WAKE_LOCK --android-entrypoint org.kivy.android.PythonActivity --android-apptheme @android:style/Theme.NoTitleBar --orientation portrait --window --wakelock --copy-libs --local-recipes /home/zedr/src/trail/recipes --arch armeabi-v7a --color=always --storage-dir="/home/zedr/src/trail/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21

Spec file:

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
p4a.source_dir = ~/src/python-for-android

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Dirk-Sandbergcommented, May 9, 2020

Hmm… now it isn’t happening. I was running into another error (not while setting the p4a source dir) related to not having libssl-dev installed. Error was

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

After I apt install libssl-dev, it appears that I’ve fixed both my errors (??).

1reaction
alanverdugocommented, Nov 22, 2020

Hello, I get this same error, and I’ve just updated buildozer with buildozer android update while trying to troubleshoot another issue.

However, my problem didn’t fix itself like in the previous comments! Also, I’ve never set any values for p4a.source_dir = and it used to work perfectly before the update.

My current Buildozer version: Buildozer 1.0.1-dev0

Now, whenever I run buildozer android release I get the following error:

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/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
    main()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
    getattr(self, command)(args)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    func(self, args, **kw)
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1128, in apk
    output, build_args = self._build_package(args, package_type='apk')
  File "/home/ark/git/gilbert/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1029, in _build_package
    build_args = build.parse_args_and_make_package(
AttributeError: module 'build' has no attribute 'parse_args_and_make_package'

Is there any way for me to go back to a stable version? It feels like I am breaking more stuff while trying to fix my problems. Any help would be appreciated! thanks!

Hi, in case anybody is having the same problem: I fixed it by executing buildozer android clean and then buildozer android release again.

The build takes much longer now, and I do not know why it broke, or why this seems to fix it, but at least it is working now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kivy Buildozer AttributeError: 'Context' object has no ...
I'm trying to build an apk for a simple python3/kivy app using buildozer in the virtual machine I got straight from kivy.org, ...
Read more >
buildozer 0.36
you to have a ready to use vm for building android application. ... Buidozer 0.33 AttributeError: 'module' object has no attribute 'directory' ...
Read more >
Installation — Buildozer 0.11 documentation
Buildozer tries to give you hints or tries to install few things for you, but it doesn't cover every situation. First, install the...
Read more >
(buildozer) AttributeError: 'pyrx' object has no attribute ' ...
When I run buildozer ("buildozer android debug build run logcat") and start the mining process (so rx_slow_hash is called) on my Pixel 5,...
Read more >
'org.kivy.android.PythonActivity' object has no attribute ' ...
PythonActivity' object has no attribute 'changeKeyboard' ... File "/home/nick/Collision2048/.buildozer/android/platform/build-armeabi-v7a/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found