Skip to content

Why an error occurs 'python-for-android cannot continue; aborting'? #1266

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

Closed
HeaTTheatR opened this issue May 12, 2018 · 6 comments
Closed

Comments

@HeaTTheatR
Copy link

Installed python-for-android using the instructions:

pip install git+https://github.com/kivy/python-for-android.git

I am trying to build a project - https://github.com/inclement/Pyonic-interpreter

Here is the code from Pyonic-interprete/sertup.py (pointed only his way to crystax-ndk):

from setuptools import setup, find_packages
from distutils.extension import Extension
from Cython.Distutils import build_ext

from os.path import join, dirname

packages = find_packages()

with open(join(dirname(__file__), 'version.txt'), 'r') as fileh:
    version = fileh.read().strip()

options = {'apk': {'window': None,
                   'requirements': 'sdl2,kivy,python2,pygments,jedi',
                   'android-api': 19,
                   'ndk-dir': '/home/zavulon/Opt/crystax-ndk-10.3.2',
                   'dist-name': 'pyonic_python2',
                   'ndk-version': '10.3.2',
                   'package': 'net.inclem.pyonicinterpreter',
                   'permission': 'INTERNET',
                   'service': 'interpreter:interpreter_subprocess/interpreter.py',
                   # 'service': 'pip:interpreter_subprocess/interpreter.py',
                   # 'services': 'pip:interpreter_subprocess/interpreter.py;interpreter:interpreter_subprocess/interpreter.py',
                   'arch': 'armeabi-v7a',
                   'icon': 'build_assets/icon_py2-96.png',
                   'presplash': 'build_assets/presplash.png',
                   'whitelist': 'build_assets/whitelist.txt',
                   'local-recipes': './p4a_recipes',
                   # 'release': None,
                   # 'debug': None,
                   }}
setup(
    name='Pyonic Python 2 interpreter',
    version=version,
    description='A Python mobile IDE experiment',
    author='Alexander Taylor',
    author_email='alexanderjohntaylor@gmail.com',
    packages=packages,
    options=options,
    package_data={'pyonic': ['*.py', '*.kv'],
                  'pyonic/interpreter_subprocess': ['*.py'],
                  'pyonic/assets': ['*.ttf', '*.txt']}
)

Run build:

python setup.py apk

Get error:

Including pyonic/pipinterface.py
Including pyonic/interpreterwrapper.py
Including pyonic/interpreter.py
Including pyonic/__init__.py
Including pyonic/utils.py
Including pyonic/editor.py
Including pyonic/menu.py
Including pyonic/main.py
Including pyonic/settings.py
Including pyonic/android_runnable.py
Including pyonic/widgets.py
Including pyonic/jediinterface.py
Including pyonic/main.kv
Including pyonic/interpreter.kv
Including pyonic/pipinterface.kv
Including pyonic/menu.kv
Including pyonic/editor.kv
Including pyonic/settings.kv
Including pyonic/interpreter_subprocess/interpreter.py
Including pyonic/assets/fontello.ttf
Including pyonic/assets/LICENSE.txt
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found possible SDK dirs in buildozer dir: android-sdk-23
[INFO]:    Will attempt to use SDK at /home/zavulon/.buildozer/android/platform/android-sdk-23
[WARNING]: This SDK lookup is intended for debug only, if you use python-for-android much you should probably maintain your own SDK download.
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (9, 19, 23)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Getting NDK dir from from user argument
[INFO]:    Got NDK version from from user argument
[INFO]:    Using Crystax NDK 10.3.2
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[WARNING]: include directory doesn't exist: /home/zavulon/Opt/crystax-ndk-10.3.2/sysroot/usr/include/arm-linux-androideabi
[INFO]:    Found the following toolchain versions: ['4.9', '5', 'clang3.6', 'clang3.7']
[INFO]:    Picking the latest gcc toolchain, here 5
[ERROR]:   python-for-android cannot continue; aborting

What is the problem?

Using Python 2.7

@inclement
Copy link
Member

I'm not sure what's wrong here, but it looks like p4a is maybe getting confused between the crystax NDK and the one in ~/.buildozer. Perhaps this is due to a bug somewhere. Does it work if you either delete the ~/.buildozer version, or the crystax ndk (since you're using python2 you don't need the crystax ndk)?

@HeaTTheatR
Copy link
Author

Remove folder ~/.buildozer.
Edit fole setup.py:

from setuptools import setup, find_packages
from distutils.extension import Extension
from Cython.Distutils import build_ext

from os.path import join, dirname

packages = find_packages()

with open(join(dirname(__file__), 'version.txt'), 'r') as fileh:
    version = fileh.read().strip()

options = {'apk': {'window': None,
                   'requirements': 'sdl2,kivy,python2,pygments,jedi',
                   'android-api': 19,
                   'ndk-dir': '/home/zavulon/Opt/android-ndk-r9c',
                   'sdk-dir': '/home/zavulon/Opt/android-sdk-23',
                   'dist-name': 'pyonic_python2',
                   'ndk-version': '9c',
                   'sdk-version': '23',
                   'package': 'net.inclem.pyonicinterpreter',
                   'permission': 'INTERNET',
                   'service': 'interpreter:interpreter_subprocess/interpreter.py',
                   # 'service': 'pip:interpreter_subprocess/interpreter.py',
                   # 'services': 'pip:interpreter_subprocess/interpreter.py;interpreter:interpreter_subprocess/interpreter.py',
                   'arch': 'armeabi-v7a',
                   'icon': 'build_assets/icon_py2-96.png',
                   'presplash': 'build_assets/presplash.png',
                   'whitelist': 'build_assets/whitelist.txt',
                   'local-recipes': './p4a_recipes',
                   # 'release': None,
                   # 'debug': None,
                   }}
setup(
    name='Pyonic Python 2 interpreter',
    version=version,
    description='A Python mobile IDE experiment',
    author='Alexander Taylor',
    author_email='alexanderjohntaylor@gmail.com',
    packages=packages,
    options=options,
    package_data={'pyonic': ['*.py', '*.kv'],
                  'pyonic/interpreter_subprocess': ['*.py'],
                  'pyonic/assets': ['*.ttf', '*.txt']}
)

Get error:

running apk
Including pyonic/pipinterface.py
Including pyonic/interpreterwrapper.py
Including pyonic/interpreter.py
Including pyonic/__init__.py
Including pyonic/utils.py
Including pyonic/editor.py
Including pyonic/menu.py
Including pyonic/main.py
Including pyonic/settings.py
Including pyonic/android_runnable.py
Including pyonic/widgets.py
Including pyonic/jediinterface.py
Including pyonic/main.kv
Including pyonic/interpreter.kv
Including pyonic/pipinterface.kv
Including pyonic/menu.kv
Including pyonic/editor.kv
Including pyonic/settings.kv
Including pyonic/interpreter_subprocess/interpreter.py
Including pyonic/assets/fontello.ttf
Including pyonic/assets/LICENSE.txt
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Getting Android API version from user argument
[INFO]:    Available Android APIs are (9, 19, 23)
[INFO]:    Requested API target 19 is available, continuing.
[INFO]:    Getting NDK dir from from user argument
[INFO]:    Got NDK version from from user argument
[INFO]:    Using Google NDK r9c
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[WARNING]: include directory doesn't exist: /home/zavulon/Opt/android-ndk-r9c/sysroot/usr/include/arm-linux-androideabi
[INFO]:    Found the following toolchain versions: ['4.6', '4.8', 'clang3.3']
[INFO]:    Picking the latest gcc toolchain, here 4.8
[ERROR]:   python-for-android cannot continue; aborting

@RobertFlatt
Copy link
Contributor

Same problem here, I'm using Python 3.5, Crystax, Gradle (no buildozer)
[WARNING]: include directory doesn't exist: /blah/blah/crystax-ndk-10.3.2/sysroot/usr/include/arm-linux-androideabi

The 'sysroot' include path is explicitly added in pythonforandroid/build.py line 365
And tested for existence in the following line.
The specified path is not part of the Crystax distribution

Workaround : Comment out the test - p4a builds and the apk installs and runs.
To comment the code: make a local clone with git, edit build.py, install the modified clone with pip

@inclement
Copy link
Member

Thanks for this note, I hadn't looked at the code to understand the problem, but what you've pointed out makes it clear that the build was broken by a recent merge.

I've reverted that change, does the p4a master branch work for you now?

Sorry about that.

@RobertFlatt
Copy link
Contributor

Confirmed, I get running apk with the new master. Thanks for the fast response. And it is amazingly cool to see Kivy running on my phone :)

I installed python-for-android using (and I assume the git form would also work):
pip install https://github.com/kivy/python-for-android/tarball/master

FYI I use Cython 0.24.1 , and Kivy 1.10.1dev. No idea if these particular versions are required now.

@inclement
Copy link
Member

Great, sorry again about breaking things, that's my mistake. I'll try to improve the tests to make sure such a thing can't slip through again.

As far as versions go, using Kivy master with any recent cython version should be fine, I think. Kivy master should become Kivy 1.10.1 stable soon.

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

3 participants