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

Issue of AttributeError #1246

Closed
katcom opened this issue Mar 29, 2018 · 5 comments
Closed

Issue of AttributeError #1246

katcom opened this issue Mar 29, 2018 · 5 comments

Comments

@katcom
Copy link

katcom commented Mar 29, 2018

The version of NDK is r16c, operated on debian 9.40.
When the command was run, "p4a create --requirement=pil", following error occurred.

[INFO]: Will compile for the following archs: armeabi
[INFO]: Found Android API target in $ANDROIDAPI
[INFO]: Available Android APIs are (15, 16, 25, 26, 27)
[INFO]: Requested API target 15 is available, continuing.
[INFO]: Found NDK dir in $ANDROIDNDK
[INFO]: Got NDK version from $ANDROIDNDKVER
[INFO]: Using Google NDK r16
[INFO]: Found virtualenv at /usr/bin/virtualenv
[INFO]: Found the following toolchain versions: ['4.9']
[INFO]: Picking the latest gcc toolchain, here 4.9
[WARNING]: Missing executable: pkg-config is not installed
[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: []
[INFO]: Trying to find a bootstrap that matches the given recipes.
[INFO]: Found 7 acceptable bootstraps: ['sdl2_gradle', 'sdl2_gradle', 'webview', 'webview', 'pygame', 'service_only', 'service_only']
[INFO]: Using the first of these: sdl2_gradle
[INFO]: Found a single valid recipe set: []
[INFO]: The selected bootstrap is sdl2_gradle
[INFO]: # Creating dist with sdl2_gradle bootstrap
[INFO]: Dist will have name unnamed_dist_1 and recipes ()
[INFO]: Dist will also contain modules () installed from pip
[INFO]: -> running cp -r /home/katcom/.local/lib/...(and 142 more)
[INFO]: -> directory context /home/katcom/.local/share/python-for-android/build/bootstrap_builds/sdl2_gradle
[INFO]: <- directory context /home/katcom/AndroidStudioProjects/PythonEmbeded/python-for-android
[INFO]: Recipe build order is []
[INFO]: # Downloading recipes
[INFO]: # Building all recipes for arch armeabi
[INFO]: # Unpacking recipes
[INFO]: # Prebuilding recipes
[INFO]: # Building recipes
[INFO]: # Biglinking object files
[INFO]: Collating object files from each recipe
Traceback (most recent call last):
File "/usr/local/bin/p4a", line 11, in
load_entry_point('python-for-android==0.6.0', 'console_scripts', 'p4a')()
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 975, in main
ToolchainCL()
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 512, in init
getattr(self, args.subparser_name.replace('-', '_'))(args)
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 149, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/build.py", line 581, in build_recipes
biglink(ctx, arch)
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/build.py", line 658, in biglink
env = arch.get_env()
File "/home/katcom/.local/lib/python2.7/site-packages/pythonforandroid/archs.py", line 54, in get_env
self.ctx.python_recipe.version[0:3])
AttributeError: 'NoneType' object has no attribute 'version'

Then execution was over.
Is it missing configuration?Or a bug?I remember that this command once succeeded in making a distribution.

@katcom katcom closed this as completed Mar 31, 2018
@simon2x
Copy link

simon2x commented Jun 4, 2018

Did you manage to fix this problem? I'm having the same exact issue..

@katcom
Copy link
Author

katcom commented Jun 8, 2018

The parameter " --requirement=pil" should be " --requirements=pil ".
I think that it is a the problem caused by typo.

@AndreMiras
Copy link
Member

Yes I also got the issue running with buildozer and the problem was the requirements had some kinda syntax error, so same story.
Nonetheless it would be great to have some kind of parsing and argument checking to prevent that.

@roland1984
Copy link

Hi!
I seem to be having the same issue. I don't think I'm having some sort of syntax error though. Any idea what might be causing the build to fail in my case?

Any help is much appreciated.

Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.0.5 (amd64).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/roland/.virtualenvs/twinstagram/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool
# Install platform
# Run "/usr/bin/python -m pip install -q  'appdirs' 'colorama>=0.3.3' 'jinja2' 'six'"
# Cwd None
# Apache ANT found at /home/roland/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/roland/.buildozer/android/platform/android-sdk-20
# Android NDK found at /home/roland/.buildozer/android/platform/android-ndk-r10e
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=compass --bootstrap=sdl2 --requirements= --arch armeabi-v7a --copy-libs --color=always --storage-dir="/usr/share/kivy-examples/android/compass/.buildozer/android/platform/build"'
# Cwd /usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI
[INFO]:    Available Android APIs are (19)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK
[INFO]:    Got NDK version from $ANDROIDNDKVER
[INFO]:    Using Google NDK r10e-rc4
[INFO]:    Found virtualenv at /home/roland/.local/bin/virtualenv
[INFO]:    Found the following toolchain versions: ['4.8', '4.9', 'clang3.5', 'clang3.6']
[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: []
[INFO]:    The selected bootstrap is sdl2_gradle
[INFO]:    # Creating dist with sdl2_gradle bootstrap
[INFO]:    Dist will have name compass and recipes ()
[INFO]:    Dist will also contain modules () installed from pip
[INFO]:    -> running cp -r /usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/bootstraps/sdl2/build /usr/share/kivy-examples/android/compass/.buildozer/android/platfor...(and 42 more)
[INFO]:    -> directory context /usr/share/kivy-examples/android/compass/.buildozer/android/platform/build/build/bootstrap_builds/sdl2_gradle
[INFO]:    <- directory context /usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain
[INFO]:    Recipe build order is []
[INFO]:    # Downloading recipes 
[INFO]:    # Building all recipes for arch armeabi-v7a
[INFO]:    # Unpacking recipes
[INFO]:    # Prebuilding recipes
[INFO]:    # Building recipes
[INFO]:    # Biglinking object files
[INFO]:    Collating object files from each recipe
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 978, in <module>
    main()
  File "/usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 975, in main
    ToolchainCL()
  File "/usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 512, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 149, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/usr/share/kivy-examples/android/compass/.buildozer/android/platform/python-for-android-new-toolchain/pythonforandroid/toolchain.py", line 193, in build_dist_from_args
    build_recipes(build_order, python_modules, ctx)
  File "pythonforandroid/build.py", line 581, in build_recipes
    biglink(ctx, arch)
  File "pythonforandroid/build.py", line 658, in biglink
    env = arch.get_env()
  File "pythonforandroid/archs.py", line 150, in get_env
    env = super(ArchARMv7_a, self).get_env(with_flags_in_cc)
  File "pythonforandroid/archs.py", line 54, in get_env
    self.ctx.python_recipe.version[0:3])
AttributeError: 'NoneType' object has no attribute 'version'
# Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=compass --bootstrap=sdl2 --requirements= --arch armeabi-v7a --copy-libs --color=always --storage-dir="/usr/share/kivy-examples/android/compass/.buildozer/android/platform/build"
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2

in my buildozer.spec I have to following lines uncommented:

...
# (int) Android SDK version to use
android.sdk = 20

# (str) Android NDK version to use
android.ndk = 10e-rc4

# (int) Android NDK API to use (optional). This is the minimum API your app will support. 
#android.ndk_api = 19

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path = /home/roland/.buildozer/android/platform/android-ndk-r10e
...

@AndreMiras
Copy link
Member

Yes you have a syntax error, your requirement line is empty, see that line:

# Run '/usr/bin/python -m pythonforandroid.toolchain create --dist_name=compass --bootstrap=sdl2 --requirements= --arch armeabi-v7a --copy-libs --color=always --storage-dir="/usr/share/kivy-examples/android/compass/.buildozer/android/platform/build"'

Specifically:

--requirements= --arch

For support questions, try #support on Discord 😄

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

4 participants