1

os : linux(ubuntu 16.04 LTS, 64-bit) python_version : 3.6.3

  • Using virtualenv.
  • I tried to install many version of kivy with many different versions of cython but always i got same error which is like below.
  • After giving "pip install kivy" this install some packages: certifi (2017.11.5) chardet (3.0.4) Cython (0.26) docutils (0.14) idna (2.6) Kivy-Garden (0.1.4) pip (9.0.1) Pygments (2.2.0) requests (2.18.4) setuptools (38.4.0) urllib3 (1.22) wheel (0.30.0)
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-build-c8ofsvs6/kivy/kivy/include -I/usr/include/python3.6m -I/home/ubuntu/venv/include/python3.6m -c /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c -o

build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.o /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c:4:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for kivy
  Running setup.py clean for kivy
Failed to build kivy
Installing collected packages: kivy
  Running setup.py install for kivy ... error
    Complete output from command /home/ubuntu/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-c8ofsvs6/kivy/setup.py';f=getattr(tokenize,

'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-vcdy_iv_-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.6/kivy: Using distutils

and last

>     > Detected compiler is unix
>     >     skipping '/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c' Cython extension (up-to-date)
>     >     building 'kivy._event' extension
>     >     creating build/temp.linux-x86_64-3.6
>     >     creating build/temp.linux-x86_64-3.6/tmp
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy
>     >     creating build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy
>     >     x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/tmp/pip-build-c8ofsvs6/kivy/kivy/include -I/usr/include/python3.6m -I/home/ubuntu/venv/include/python3.6m -c /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c -o
>     > build/temp.linux-x86_64-3.6/tmp/pip-build-c8ofsvs6/kivy/kivy/_event.o
>     >     /tmp/pip-build-c8ofsvs6/kivy/kivy/_event.c:4:20: fatal error: Python.h: No such file or directory
>     >     compilation terminated.
>     >      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
>     >     
>     >     ---------------------------------------- Command "/home/ubuntu/venv/bin/python3 -u -c "import setuptools,
>     > tokenize;__file__='/tmp/pip-build-c8ofsvs6/kivy/setup.py';f=getattr(tokenize,
>     > 'open', open)(__file__);code=f.read().replace('\r\n',
>     > '\n');f.close();exec(compile(code, __file__, 'exec'))" install
>     > --record /tmp/pip-vcdy_iv_-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/ubuntu/venv/include/site/python3.6/kivy" failed with error code
>     > 1 in /tmp/pip-build-c8ofsvs6/kivy/
  • I have also tried with cython 0.25.2

3 Answers3

2

Ok now i figured this issue. This is because of pip cache packages installation i had cython and kivy broken packages in cache due to this every time instead of download a new one pip uses cache which​ has already broken. And now how did these packages broken because of switching python default version sudo update-alternatives --config python3 here i had set python3.6 default and downloaded all packages but some internal working of ubuntu (don't know) do not realy support python3.6 it supports python3.5 due to this download packages currept and goes to cache and when i switch to python3.5 ubuntu works pretty fine but packages had broken.

1

Instead of pip try apt:

 sudo add-apt-repository ppa:kivy-team/kivy
 sudo apt-get update
 sudo apt-get install python-kivy # or python3-kivy if you're using python3
0

Try to install pip install cython==0.25.0 and then install all the requirements from Kivy official install intructions.

It's possible that you can use newer version of cython, but last time when I tried with cython 0.26 and kivy 1.10 I had to downgrade cython.

Qback
  • 1,093