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

#error from Cython compilation #150

Closed
DexterInd opened this issue Oct 9, 2014 · 25 comments
Closed

#error from Cython compilation #150

DexterInd opened this issue Oct 9, 2014 · 25 comments

Comments

@DexterInd
Copy link

Hey folks,
I'm running Ubuntu 12.04, and I've followed the directions for installation of Cython. After running into this error,

building 'kivy.graphics.shader' extension
arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/dexter/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -DNDEBUG -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/dexter/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm -fPIC -I/home/dexter/.buildozer/android/platform/android-ndk-r9c/platforms/android-14/arch-arm/usr/include -I/home/dexter/Android/Kivy/venv/kivy_android_app_1/.buildozer/android/platform/python-for-android/build/python-install/include/python2.7 -c kivy/graphics/shader.c -o build/temp.linux-i686-2.7/kivy/graphics/shader.o
kivy/graphics/shader.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
 error: command 'arm-linux-androideabi-gcc' failed with exit status 1
# Command failed: ./distribute.sh -m "kivy" -d "kivycrash2"

I ran the following:

sudo pip uninstall buildozer
sudo pip uninstall cython

I deleted the .buildozer directory, then set about installing again:

sudo pip install --upgrade cython
sudo pip install --upgrade buildozer

But I'm still getting the same errors unfortunately.

When I run
cython -V
I get back Cython version 0.21

@toufikovich
Copy link

I have faced the same error with the cython version 21, I don't know how to solve that in order to compile kivy with higher API levels .... But if u wanna downgrade cython try : sudo pip install Cython==0.17.1

@fccoelho
Copy link

For me it keeps failing even after downgrading to 0.17.1

@jayece09
Copy link

jayece09 commented Feb 4, 2015

Same issue.
In addition it returns!
Packages missing: cython
It might break the compilation, except if you installed thoses packages manually.
Check enviromnent


But I have cython!

@ohaz
Copy link

ohaz commented Feb 4, 2015

Try it with version 0.20 - this one should work. (pip uninstall cython && pip install cython==0.20). If it still fails, then I don't know how to fix it
Kivy 1.9 will support the newest cython version.

@jayece09
Copy link

jayece09 commented Feb 4, 2015

Still same error and muliple instances of error related to:-
kivy/graphics/vertex_instructions.pyx:107:27: C attributes cannot be added in implementation part of extension type defined in a pxd

Error compiling Cython file:

...
# c) create BezierSpline subclass that does the computation

cdef list _points
cdef int _segments
cdef bint _loop
cdef int _dash_offset, _dash_length
                      ^

kivy/graphics/vertex_instructions.pyx:107:27: '_dash_length' redeclared


Finally stops with :-
-o build/temp.linux-x86_64-2.7/kivy/graphics/vertex_instructions.o
kivy/graphics/vertex_instructions.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'ccache' failed with exit status 1
#Command failed: ./distribute.sh -m "kivy" -d "myapp"


@gustavklopp
Copy link

ohaz said:

Try it with version 0.20 - this one should work. (pip uninstall cython && pip install cython==0.20). If it still fails, then I don't know how to fix it
Kivy 1.9 will support the newest cython version.

Exactly! Thanks. By the way, I'm using virtualenv (on Ubuntu 14.10).

Maybe we should edit the step by step guide here:

http://kivy.org/docs/installation/installation-linux.html

(since cython==0.22 can't work)

@fscz
Copy link

fscz commented Feb 20, 2015

Same here. I got it to work yesterday on a fresh raspbian/raspberry pi 2 with following steps:

apt-get update && apt-get upgrade
apt-get install python-setuptools python-pygame python-opengl python-gst0.10 python-enchant gstreamer0.10-plugins-good python-dev build-essential libgl1-mesa-dev libgles2-mesa-dev python-pip libgstreamer1.0-dev
pip install cython==0.20
pip install kivy

Meanwhile I have installed some additional packages and now I cannot get it to work any more. I think this suggests that the problem is caused by the build env. I think I have installed libgstreamer1.0 meanwhile. And I can also see 'use_gstreamer = True' at the beginning of the build. Strange how that would be related to an error in vertex instructions. Maybe it is due to another lib, I don't remember exactly, but I also installed some sdl packages.

@fscz
Copy link

fscz commented Feb 20, 2015

This builds:
* use_rpi = False
* use_opengl_es2 = True
* use_opengl_debug = False
* use_glew = False
* use_sdl = False
* use_ios = False
* use_mesagl = False
* use_x11 = False
* use_gstreamer = True
* use_avfoundation = False

This doesn't:

 * use_rpi = True

 * use_opengl_es2 = True

 * use_opengl_debug = False

 * use_glew = False

 * use_sdl = False

 * use_ios = False

 * use_mesagl = False

 * use_x11 = False

 * use_gstreamer = True

 * use_avfoundation = False

Only difference is use_rpi = True

@rastogiachyut
Copy link

None of the help above fixes issue for my pc.
My log if its usefull:
https://gist.github.com/rastogiachyut/d8ec3dfb09e741753415

@LuxoftAKutsan
Copy link

Hello, I had the same error on ArchLinux.
Was fixed by installing
sudo pacman -Sy python-pip2
then install cython 0.20
sudo pip2 install cython==0.20

@LuxoftAKutsan
Copy link

could please anybody explain, why kivy doesn't work with cython 0.22?

@inclement
Copy link
Member

@LuxoftAKutsan Cython 0.22 introduced a breaking change in an api that kivy used significantly. This isn't uncommon in itself, but in this case the obvious fix had significant performance implications, and we were not sure if the cython team would consider it a bug and fix it or if we should find a workaround. The reality seems to be that we will implement a middle-ground fix with small performance implications, but this took a little time to sort out for the above reasons.

I don't know for sure if/when we will apply such a fix.

@debeshm
Copy link

debeshm commented May 8, 2015

I tried installing cython 0.20....it perfectly works now

sudo pip install cython==0.20

@sspreitzer
Copy link

Tried successfully with 0.21

sudo pip install Cython==0.21

@giuliano-macedo
Copy link

Thank you @ohaz

@dvenkatsagar
Copy link
Contributor

Im on ubuntu 14.04 and for me it worked with cython==0.20.1 and it was install from apt-get and not pip.

@kived
Copy link
Contributor

kived commented Sep 10, 2015

This issue is a mess, there are multiple different issues all being piled into one place.

Some of these issues seem to be related to older Kivy versions; if you can duplicate these issues with the current version then please open a new issue.

As for this one: C attributes cannot be added in implementation part of extension type defined in a pxd

This is a known issue due to a bug in Cython. Kivy installs the .pxd files so that you can build your own code against Kivy's Cython code. But Cython checks the site packages path for .pxd files FIRST, and then checks the local folder. So if there is a conflict between the newer dev version and the older installed version, you will get this error. The only workaround currently is to uninstall the currently installed version of Kivy, or make sure the installed version matches the version you are trying to build with buildozer.

@kived kived closed this as completed Sep 10, 2015
@frankforp
Copy link

frankforp commented Jun 20, 2017

when i tried to install the development environment in raspberry b+ and experienced the similar problems as follow, the Cython version is 0.23

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: 'reload' already defined
building 'kivy.graphics.svg' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Ikivy/include -Ikivy/include -I/usr/include/python2.7 -c kivy/graphics/svg.c -o build/temp.linux-armv7l-2.7/kivy/graphics/svg.o
kivy/graphics/svg.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Makefile:35: recipe for target 'build' failed

@tshirtman
Copy link
Member

@frankforp your issue seem to be better tracked at kivy/kivy#5228

@NahashonM
Copy link

running python 2.7.13
kivy 1.9.1
cython 0.20

Try installing cython with root privileges.
That worked for me

@frankforp
Copy link

@tshirtman , I'm sorry for the late reply, Thank you very much for your reply,
That problem is very similar to mine.

Thanks,
Frank

@NahashonM
Copy link

NahashonM commented Sep 21, 2017 via email

@mvitec
Copy link

mvitec commented Nov 16, 2017

for others
Linux Mint 17.3 x32, python 3.4.3,
apt-get install:
python-dev
libportmidi-dev
libswscale-dev
libavformat-dev
libavcodec-dev
zlib1g-dev
libsdl2-dev
libsdl2-image-dev
libsdl2-mixer-dev
libsdl2-ttf-dev
with Cython==0.27
pip3 install Kivy (1.10.0)
... error .... svg.c ...
pip3 install -I Cython==0.25.2

successfully completed

@lmcdasm
Copy link

lmcdasm commented Apr 29, 2018

Hey all.

so, this weekend i thought I would check this library out and play.

while downloading the examples seems to run and work, any attempt to follow the install instructions and tutorials for running a simple "first app" fail.

This was tried on the following combinations:

  • window 32/64 with Pyt 36-32 pt36-64. All issues fail at the Cython part in some for or another (chasing down version imcompatibilities)
  • Ubuntu instructions - these get a bit further, but then fail at the SVG issues.
    - MAC - same thing.

Thus, while the examples and web site look nice, you either have to butcher and patch from the examples to library trace or you spend more than 10 hours linking libs together just to get kivy to install.. all that to bring up a single window and get started..

Ill keep an eye out when the package gets a clean installation so we can explore the language, rather than pip :)

Good luck!

@killatsignlife
Copy link

killatsignlife commented Sep 2, 2023

When I tried to downgrade Cython to 0.20 version, I receive this message:

Requirement already satisfied: kivy in /home/leite/.local/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (2.2.1)
Requirement already satisfied: buildozer in /home/leite/miniconda3/envs/ludic/lib/python3.11/site-packages (from -r requirements.txt (line 2)) (1.5.0)
Requirement already satisfied: python-dotenv in /home/leite/miniconda3/envs/ludic/lib/python3.11/site-packages (from -r requirements.txt (line 3)) (1.0.0)
Collecting cython==0.20 (from -r requirements.txt (line 4))
  Using cached Cython-0.20.tar.gz (2.6 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      /tmp/pip-install-jrv5htyr/cython_3a8896ecb7c84f8da121eb5da1c2fb2f/setup.py:37: DeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
        import lib2to3.refactor
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-jrv5htyr/cython_3a8896ecb7c84f8da121eb5da1c2fb2f/setup.py", line 38, in <module>
          from distutils.command.build_py \
      ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py' (/home/leite/miniconda3/envs/ludic/lib/python3.11/site-packages/setuptools/_distutils/command/build_py.py)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Does anyone know how to solve this error?

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