kivy: Kivy fails to build using cython 0.27.1

Versions

  • Python: 3.6.2
  • OS: Arch linux
  • Kivy: 1.10.0
  • Kivy installation method: buildozer

Description

I was trying to build an apk using buildozer. Using the latest cython 0.27.1 throws the following error. It can be fixed by downgrading cython to 0.25.2 work as well. The problem is that pip and my OS always want to upgrade cython.

Code and Logs

`

[INFO]: -> running cython ./kivy/graphics/svg.pyx

Exception in thread background thread for pid 4272:
Traceback (most recent call last): File “/usr/lib/python3.6/threading.py”, line 916, in _bootstrap_inner self.run() File “/usr/lib/python3.6/threading.py”, line 864, in run self._target(*self._args, **self._kwargs) File “/usr/lib/python3.6/site-packages/sh.py”, line 2170, in background_thread handle_exit_code(exit_code) File “/usr/lib/python3.6/site-packages/sh.py”, line 1929, in fn return self.command.handle_command_exit_code(exit_code) File “/usr/lib/python3.6/site-packages/sh.py”, line 672, in handle_command_exit_code raise exc sh.ErrorReturnCode_1:

RAN: /usr/bin/cython ./kivy/graphics/svg.pyx

STDOUT:

Error compiling Cython file:

… end = time() Logger.debug(“Svg: Loaded {} in {:.2f}s”.format(filename, end - start)) finally: fd.close()

cdef void reload(self) except *:
    ^

kivy/graphics/svg.pyx:469:9: Signature not compatible with previous declaration

Error compiling Cython file:

… cpdef flag_update(self, int do_parent=?, list _instrs=?) ELSE: cpdef flag_update(self, int do_parent=?) cdef void flag_update_done(self) cdef void set_parent(self, Instruction parent) cdef void reload(self) ^

kivy/graphics/instructions.pxd:36:20: Previous declaration is here

STDERR:

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/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py”, line 916, in <module> main() File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py”, line 913, in main ToolchainCL() File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py”, line 514, in init getattr(self, args.subparser_name.replace(‘-’, ''))(args) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py”, line 147, in wrapper_func build_dist_from_args(ctx, dist, args) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py”, line 192, in build_dist_from_args build_recipes(build_order, python_modules, ctx) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/build.py”, line 572, in build_recipes recipe.build_arch(arch) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipe.py”, line 975, in build_arch self.build_cython_components(arch) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipe.py”, line 1010, in build_cython_components self.cythonize_build(env=env) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipes/kivy/init.py”, line 18, in cythonize_build super(KivyRecipe, self).cythonize_build(env, build_dir=build_dir) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipe.py”, line 1055, in cythonize_build self.cythonize_file(env, build_dir, join(root, filename)) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipe.py”, line 1046, in cythonize_file shprint(cython_command, filename, *self.cython_args, _env=cyenv) File “/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.buildozer/android/platform/python-for-android-master/pythonforandroid/logger.py”, line 175, in shprint for line in output: File “/usr/lib/python3.6/site-packages/sh.py”, line 720, in next self.wait() File “/usr/lib/python3.6/site-packages/sh.py”, line 651, in wait self.handle_command_exit_code(exit_code) File “/usr/lib/python3.6/site-packages/sh.py”, line 672, in handle_command_exit_code raise exc sh.ErrorReturnCode_1:

RAN: /usr/bin/cython ./kivy/graphics/svg.pyx

STDOUT:

Error compiling Cython file:

… end = time() Logger.debug(“Svg: Loaded {} in {:.2f}s”.format(filename, end - start)) finally: fd.close()

cdef void reload(self) except *:
    ^

kivy/graphics/svg.pyx:469:9: Signature not compatible with previous declaration

Error compiling Cython file:

… cpdef flag_update(self, int do_parent=?, list _instrs=?) ELSE: cpdef flag_update(self, int do_parent=?) cdef void flag_update_done(self) cdef void set_parent(self, Instruction parent) cdef void reload(self) ^

kivy/graphics/instructions.pxd:36:20: Previous declaration is here

STDERR:

Command failed: /usr/bin/python -m pythonforandroid.toolchain create --dist_name=kivyCalc --bootstrap=sdl2 --requirements=kivy,python3crystax==3.6 --arch armeabi-v7a --copy-libs --color=always --storage-dir=/home/l33tlinuxh4x0r/code/p4a/kivyCalc/.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

`

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 20 (6 by maintainers)

Most upvoted comments

@vanschelven please try with kivy master, it’s stable, and has many bug solved compared to latest release, most of the work needed for release is not about code now.

edit: i just installed Cython 0.28.2 and then kivy master in a clean python3 virtualenv, it worked right away.

pip install Cython==0.28.2
pip install https://github.com/kivy/kivy/archive/master.zip

I had the same problem … it’s not the most correct approach I’m sure and I admit I’m not really knowledgeable about its background, but in a referenced issue something similar to downgrading Cython to 0.26.1 was mentioned. I tried it and it did the job, so the commands:

pip install cython==0.26.1
pip install kivy

may hopefully help anyone bumping into this one in the near future, e.g. as a temp workaround.

it also worked for me Thank you very much

I just upgraded my cython to 0.27.1 then edited my buildozer.spec to point to the directory where I ran the commands that you posted.

git clone https://github.com/KeyWeeUsr/kivy
git checkout -b scoder-patch-1 --track origin/scoder-patch-1

Then I ran buildozer android clean followed by a buildozer android debug and my apk built fine using the latest cython and kivy. Works great! Any ETA on when this will be merged with master?