19

so I tried to install Kivy following the instructions from the official site:

$ sudo 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

$ sudo pip install --upgrade cython

$ sudo easy_install kivy

This is what I get:

Searching for kivy
Reading http://pypi.python.org/simple/kivy/
Best match: Kivy 1.4.1
Downloading http://pypi.python.org/packages/source/K/Kivy/Kivy-1.4.1.tar.gz#md5=94bba894269e4bdecc7881f256367e01
Processing Kivy-1.4.1.tar.gz
Running Kivy-1.4.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-MMi2Fv/Kivy-1.4.1/egg-dist-tmp-EcKbfC
[INFO   ] Kivy v1.4.1
Found GLES 2.0 headers at /usr/include/GLES2/gl2.h
Build configuration is:
 * use_opengl_es2  =  True
 * use_glew  =  False
 * use_opengl_debug  =  False
 * use_mesagl  =  False
Generate config.h
Generate config.pxi
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_identity’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2774:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_inverse’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2978:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:2980:13: error: incompatible types when assigning to type    ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_f_4kivy_8graphics_14transformation_6Matrix_multiply’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3364:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3366:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3368:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c: In function ‘__pyx_pf_4kivy_8graphics_14transformation_6Matrix_20__str__’:
/tmp/easy_install-MMi2Fv/Kivy-1.4.1/kivy/graphics/transformation.c:3674:13: error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’
 error: Setup script exited with error: command 'gcc' failed with exit status 1

After failing to find an answer in the web I began to investigate the files which generated the error: transformation.c, transformation.pyx and transformation.pyd. I also read a little about Cython.

Firstly, all errors are of the same kind:

error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’

The first error is raised here:

__pyx_t_3 = __pyx_v_self->mat;

The type of __pyx_t_3 is:

__pyx_t_4kivy_8graphics_14transformation_matrix_t

It has this weird name because it was generated automatically from the transformation.pxd file:

ctypedef double matrix_t[16]

So, type(__pyx_t_3) == type(matrix_t) == double *.

The type of __pyx_v_self is:

struct __pyx_obj_4kivy_8graphics_14transformation_Matrix *

Again, it was generated from transformation.pxd:

ctypedef double matrix_t[16]

cdef class Matrix:
    cdef matrix_t mat
    ...

Therefore, type(__pyx_v_self->mat) == type(Matrix.mat) == type(matrix_t) == double *

As we can see, both sides of the assignment:

__pyx_t_3 = __pyx_v_self->mat;

are of (double *) type.

Why is this error:

error: incompatible types when assigning to type ‘__pyx_t_4kivy_8graphics_14transformation_matrix_t’ from type ‘double *’

being raised then?

It looks like the compiler is not recognizing the type of matrix_t as a double *.

orangesky
  • 305
  • 3
  • 8

2 Answers2

16

Just met the same error. Using of Cython 0.17.1 helps me:

sudo pip install Cython==0.17.1

If you want not just fix problem you can go in depth and check what was changed between this two versions. https://github.com/cython/cython/blob/master/CHANGES.rst#0172-2012-11-20 - here you can find related issues, but unfortunately I'm not a guru of C/Cython and quick glance to diff between master and 0.17.1 doesn't says me where is the problem, but if you wish you can investigate the problem by yourself.

simplylizz
  • 1,686
  • 14
  • 28
  • Oh my God, I can't believe it worked! I was initially using an older version of Cython, then I upgrated it to the newest version: 0.17.2, I would never had imagined that I should have got an older version to make it work. Thank you very much! – orangesky Nov 21 '12 at 16:27
  • I was getting this error: `#error Do not use this file, it is the result of a failed Cython compilation` `error: command 'x86_64-linux-gnu-gcc' failed with exit status 1` and this fixed it. Thanks! +1 – Charles Clayton Dec 17 '14 at 06:06
0

I just had the same error as well. I traced it down to a small example and sent an email to the Cython mailing list: https://groups.google.com/forum/?fromgroups=#!topic/cython-users/fSZgHqrlCOc

Jason Grout
  • 631
  • 6
  • 10