Hi - I'm new to Kivy and just trying to get a test app running and having some issues displaying text. I am running Python 2.7.11 in Oracle Linux 64-bit. I noticed a very similar issue reported #3889 in which text does not seem to render in that case. Here is the log I am getting in the console after running my app:
[[1;32mINFO[0m ] [Logger ] Record log in /root/.kivy/logs/kivy_16-01-11_13.txt
[[1;32mINFO[0m ] [Kivy ] v1.9.1
[[1;32mINFO[0m ] [Python ] v2.7.11 (default, Jan 11 2016, 17:42:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
[[1;32mINFO[0m ] [Factory ] 179 symbols loaded
[[1;32mINFO[0m ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
Warning (from warnings module):
File "/usr/local/lib/python2.7/site-packages/kivy/core/text/text_pygame.py", line 24
RuntimeWarning: use font: No module named font
(ImportError: No module named font)
[[1;32mINFO[0m ] [Text ] Provider: pil(['text_pygame'] ignored)
[[1;32mINFO[0m ] [Window ] Provider: pygame(['window_egl_rpi'] ignored)
[[1;31mERROR[0m ] [WinPygame ] unable to set icon
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 215, in set_icon
self._set_icon_standard(filename)
File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 223, in _set_icon_standard
im = pygame.image.load(filename)
error: File is not a Windows BMP file
[[1;33mWARNING[0m] [WinPygame ] Video: failed (multisamples=2)
[[1;33mWARNING[0m] [WinPygame ] trying without antialiasing
[[1;32mINFO[0m ] [GL ] OpenGL version <2.1 Mesa 10.4.3>
[[1;32mINFO[0m ] [GL ] OpenGL vendor
[[1;32mINFO[0m ] [GL ] OpenGL renderer
[[1;32mINFO[0m ] [GL ] OpenGL parsed version: 2, 1
[[1;32mINFO[0m ] [GL ] Shading version <1.20>
[[1;32mINFO[0m ] [GL ] Texture max size <16384>
[[1;32mINFO[0m ] [GL ] Texture max units <32>
[[1;32mINFO[0m ] [Window ] virtual keyboard not allowed, single mode, not docked
[[1;32mINFO[0m ] [OSC ] using
[[1;32mINFO[0m ] [Base ] Start application main loop
[[1;32mINFO[0m ] [GL ] NPOT texture support is available
Exception Exception: Exception('tostring() has been removed. Please call tobytes() instead.',) in 'kivy.graphics.instructions.RenderContext.set_texture' ignored
Exception Exception: Exception('tostring() has been removed. Please call tobytes() instead.',) in 'kivy.graphics.instructions.RenderContext.set_texture' ignored
Let me know what other information might help. Thank you
The solution is to replace tostring
with tobytes
in that module.
How did you install kivy? The pygame provider has been deprecated in favor of sdl2 (which does not have this bug), could you try reinstalling it? These are the needed deps: https://kivy.org/docs/installation/installation-linux.html#ubuntu-example.
The main problem is probably that I'm not using ubuntu.
I thought that fix was included in kivy 1.9.1, which is the version I installed using:
pip2.7 install kivy
I'm running a RHEL (Red Hat Linux) distribution of linux, which uses yum to install RPMs and dependencies. The closest example I could find on the installation page is for fedora (which apparently still has to work with pygame?) which uses yum apparently as well.
The problem I'm finding is that trying to use the yum install with the SDL2 dependencies listed does not find some of them like SDL-mixer and mesa.
I started from scratch, reinstalled python2.7 and then kivy, Pillow, cython modules. This time I get the error
Not sure if RHEL linux just will not work totally with kivy at this time if there is not a complete list of dependencies available for Red Hat.
Any thoughts on next steps?
See link below for my notes on RHEL7, sadly never made it into the official docs because I've been real short on time (and motivation). I can't remember if you need to add the EPEL repository for this to work.
Also the instructions for building SDL2 are included from a different file
Thanks for the links and instructions @bionoid ... I've spent some time going through that installation document and there were still a few packages I was unable to install using yum:
mesa-libGLES-devel
glew
glew-devel
libwebp-devel
libmodplug-devel
gstreamer1
gstreamer1-devel
gstreamer1-plugins-base
gstreamer1-plugins-good
yum could not find these packages.
I did proceed and installed kivy==1.9.1, Pillow, and cython==0.23 but I am unable to get a window
Here is the log that I get after trying my test program again:
[[1;32mINFO[0m ] [Logger ] Record log in /root/.kivy/logs/kivy_16-01-13_1.txt
[[1;32mINFO[0m ] [Kivy ] v1.9.1
[[1;32mINFO[0m ] [Python ] v2.7.10 (default, Jan 13 2016, 19:46:11)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
[[1;32mINFO[0m ] [Factory ] 179 symbols loaded
[[1;32mINFO[0m ] [Image ] Providers: img_tex, img_dds, img_gif, img_pil (img_pygame, img_ffpyplayer ignored)
[[1;32mINFO[0m ] [Text ] Provider: pil(['text_pygame'] ignored)
[[1;31mCRITICAL[0m] [Window ] Unable to find any valuable Window provider at all!
egl_rpi - ImportError: cannot import name bcm
File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_egl_rpi.py", line 12, in <module>
from kivy.lib.vidcore_lite import bcm, egl
pygame - ImportError: No module named pygame
File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 8, in <module>
import pygame
x11 - ImportError: No module named window_x11
File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
fromlist=[modulename], level=0)
[[1;31mCRITICAL[0m] [App ] Unable to get a Window, abort.
Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[[1;31mCRITICAL[0m] [App ] Unable to get a Window, abort.
Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[[1;31mCRITICAL[0m] [App ] Unable to get a Window, abort.
Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[[1;31mCRITICAL[0m] [App ] Unable to get a Window, abort.
So this is where I'm stuck at the moment. I could try to spend some time to try and download the RPMs from source for the missing packages I could not install from yum, but I am not sure how critical they are.
I did reconfigure Python2.7 and it configured properly but I am not certain that the SDL2 modules were included.
I found out what I was doing wrong with this step in the RHEL config documentation:
Next add /usr/local/lib to /etc/ld.so.conf:
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf'
sudo ldconfig
Since SDL2 is built from source,
we need to tell pkg-config where to look for the .pc files for local libraries.
Make sure you run this in the same terminal as you run the:
python setup.py build_ext
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
... I needed to make sure python2.7 was built with the SDL2 binaries (which I had already installed from following https://github.com/bionoid/kivy/blob/5795ce80388d7ff4f257c7c4745edfa4ef1877d7/doc/sources/compiling/prerequisites/sdl2_from_source.txt) and the below steps filled in what I was missing with the kivy module (or something like that).
What I did was go download the development version of kivy at: https://kivy.org/docs/installation/installation.html?highlight=development
and I followed these steps:
If anyone else is having issues downloading the latest version of kivy to work in RHEL linux (I am working with RHEL linux 6 in this example) I hope this thread helps. I got text working, and I'm getting a window without pygame.
I'll leave this open as a reminder that the RHEL/Fedora instructions need an update.
@krusaderjake regarding the packages yum couldn't find, I guess that is either because you need to add the EPEL repository, or maybe a difference between RHEL6 and RHEL7, see http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
(you will need to recompile Kivy after installing gstreamer, or SDL2 for the libmodplug/libwebp if you need those)
I added the EPEL repository and I had also added:
I was able to find more of the packages using EPEL (extra packages) but these are the list of packages I could still not find using yum install on RHEL linux 6:
gstreamer1
gstreamer1-devel
gstreamer1-plugins-base
gstreamer1-plugins-good
At this point I am set up pretty solid with Kivy 1.9.2 development version. I don't believe I need gstreamer at this point (or at least I haven't received any errors in the log related to these packages). Thanks for all your help @bionoid
To solve another issue that arose (I believe it was related to using Text Input) I had to install xclip & xsel through yum install in RHEL linux 6 (because apparently those were not included in my installation of linux). Here is the stackoverflow post that assisted with solving that issue:
http://stackoverflow.com/questions/33534976/kivy-error-with-text-input
Please do update the installation instructions for RHEL/Fedora (and perhaps for Linux in general). I was told on IRC that you probably don't have prebuilt images any more, so the instructions for referencing repos for various versions of Fedora are probably no longer relevant. Perhaps the instructions should reference https://github.com/kivy/kivy/releases and also describe how to use pip to install Kivy?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please update the page to include Fedora 26 instructions, using mine which work (remove any unnecessary lines that I didn't know weren't needed):
http://www.expertmultimedia.com/usingpython/py3installingkivy-linux.html
Feel free to modify for python2 as needed or add separate instructions for that (however, wheels may install fine in python2 after doing my instructions on a distro where python2 is still the default)
I have working instructions for Windows linked from that page as well, so they should probably go on your Windows instructions page (at least for python3).
@expertmm Feel free to submit a Pull Request with the change to the Linux installation steps docs page with the right ones. :)
OK, but first I want to get my Fedora 27 instructions working. I tried:
#kivy.org says install:
#(khrplatform-devel is not found though so use android-opengl-api instead)
sudo dnf install \
make \
mercurial \
automake \
gcc \
gcc-c++ \
SDL_ttf-devel \
SDL_mixer-devel \
android-opengl-api \
mesa-libGLES \
mesa-libGLES-devel \
gstreamer-plugins-good \
gstreamer \
gstreamer-python \
mtdev-devel \
python-devel \
python-pip
sudo dnf install patch
#may or may not be needed:
sudo dnf group install "C Development Tools and Libraries"
#prevent missing redhat-hardened-cc1 error:
sudo dnf install redhat-rpm-config
#is in Ubuntu instructions on kivy.org, and seemed to get rid of some errors:
sudo dnf install git
#these were derived from the Ubuntu instructions:
sudo dnf install python-devel ffmpeg-libs SDL2-devel SDL2_image-devel \
SDL2_mixer-devel SDL2_ttf-devel portmidi-devel libavdevice \
libavc1394-devel zlibrary-devel ccache mesa-libGL mesa-libGL-devel
sudo python -m pip install --upgrade pip
sudo python -m pip install --upgrade pip wheel setuptools
sudo python -m pip install docutils pygments
#sudo python -m pip install cython
#had error still, apparently due to Cython version --see below
#install a Cython version that works with Kivy:
#according to <https://kivy.org/docs/installation/installation-linux.html#fedora> use 0.27.3
#sudo python -m pip install Cython==0.27.3
#but use 0.26.1 as mentioned on <https://github.com/SerpentAI/SerpentAI/issues/58> regarding <https://github.com/SerpentAI/SerpentAI/blob/dev/setup.py#L73>
#sudo python -m pip install Cython==0.26.1
#but use 0.25.2 because after using that and runnin pip install kivy, it says to use:
#says to install 0.25.2
#sudo python -m pip install Cython==0.25.2
#still errors will gcc so as per <https://kivy.org/docs/installation/installation-linux.html#ubuntu-11-10-or-newer> installed 0.25 as shown below:
#Kivy Cython
#1.8 0.20.2
#1.9 0.21.2
#1.9.1 0.23
#1.10.1 0.25
#NOTE: pip gets version 1.10.0 though, so found last version by starting with 0.24.9 and counting down until pip found a wheel:
#sudo python -m pip install Cython==0.24.1
#but still has error so install the one recommended by kivy make output:
sudo python -m pip install Cython==0.25.2
#for Kivy-catalog (not needed since pip brings them in with kivy)--these packages aren't needed since installed via pip above:
# sudo dnf install python2-pygments python2-docutils
#optionally, you can use pygame (rpm for python2 is pygame, rpm for python3 is python3-pygame) backend instead of sdl2: pip install hg+http://bitbucket.org/pygame/pygame
#if [ -d "/usr/lib64/python2.7/site-packages/pygame" ]; then /usr/bin/yes | sudo python -m pip uninstall pygame; fi
#if [ -d "/usr/lib64/python2.7/site-packages/numpy" ]; then /usr/bin/yes | sudo python -m pip uninstall numpy; fi
#numpy is under "Dependencies with legacy PyGame" says <https://kivy.org/docs/installation/installation-linux.html#fedora> so not needed apparently:
# sudo dnf install python2-numpy pygame
# NOTE: python2-numpy pulls dependencies: libgfortran libquadmath openblas openblas-threads python2-nose
#With Cython version recommended above, pip install kivy still says:
# Package gstreamer-1.0 was not found in the pkg-config search path.
# Perhaps you should add the directory containing `gstreamer-1.0.pc'
# to the PKG_CONFIG_PATH environment variable
# Package 'gstreamer-1.0', required by 'virtual:world', not found
# so instead install:
sudo dnf install python2-gstreamer1
#Same error still occurs, so (see <https://unix.stackexchange.com/questions/110856/something-is-terribly-wrong-with-pkg-config>) install:
sudo dnf install gstreamer-devel
# still empty PKG_CONFIG_PATH even if you do sudo ldconfig, so:
# see <http://fedora-help.blogspot.com/2009/08/installing-pidgin-26-in-fedora-11.html>
# PKG_CONFIG_PATH=/usr/lib:/usr/local/lib/pkgconfig/
# or find correct path via (as per <https://unix.stackexchange.com/questions/110856/something-is-terribly-wrong-with-pkg-config>)
# see also <https://askubuntu.com/questions/537132/how-to-compile-c-c-program-with-gstreamer> therefore:
sudo dnf install gstreamer1-devel
#find /usr -name "gstreamer-1.0"
#shows directory "/usr/lib64/gstreamer-1.0" exists (and "/usr/include/gstreamer-1.0")
#and pip install kivy says "GStreamer found via pkg-config"
sudo python -m pip install kivy --no-cache-dir
but I still get (notice the Not a git repository
line):
Installing collected packages: kivy
Running setup.py install for kivy ... error
Complete output from command /bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fAh_6m/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-1oRcJn-record/install-record.txt --single-version-externally-managed --compile:
Using distutils
Detected Cython version 0.25.2
Using this graphics system: OpenGL
GStreamer found via pkg-config
SDL2 found via pkg-config
SDL2: found SDL header at /usr/include/SDL2/SDL.h
SDL2: found SDL_mixer header at /usr/include/SDL2/SDL_mixer.h
SDL2: found SDL_ttf header at /usr/include/SDL2/SDL_ttf.h
SDL2: found SDL_image header at /usr/include/SDL2/SDL_image.h
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
running install
then after a while:
/tmp/pip-build-fAh_6m/kivy/kivy/core/audio/audio_sdl2.c:1647:63: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pip-build-fAh_6m/kivy/kivy/core/audio/audio_sdl2.c:1647:83: error: ‘MIX_INIT_FLUIDSYNTH’ undeclared (first use in this function); did you mean ‘MIX_INIT_MID’?
__pyx_v_want_flags = (__pyx_v_want_flags | ((MIX_INIT_MOD | MIX_INIT_MODPLUG) | MIX_INIT_FLUIDSYNTH));
^~~~~~~~~~~~~~~~~~~
MIX_INIT_MID
/tmp/pip-build-fAh_6m/kivy/kivy/core/audio/audio_sdl2.c: In function ‘__pyx_pf_4kivy_4core_5audio_10audio_sdl2_9MusicSDL2_extensions’:
/tmp/pip-build-fAh_6m/kivy/kivy/core/audio/audio_sdl2.c:4936:69: error: ‘MIX_INIT_MODPLUG’ undeclared (first use in this function); did you mean ‘MIX_INIT_MOD’?
__pyx_t_2 = ((__pyx_v_4kivy_4core_5audio_10audio_sdl2_mix_flags & MIX_INIT_MODPLUG) != 0);
^~~~~~~~~~~~~~~~
MIX_INIT_MOD
error: command 'gcc' failed with exit status 1
certain gcc errors used to be cured by switching to a different version of Cython, but I still can't use pip install kivy (pip install downloads Kivy 1.10.0) with Cython 0.24.1, 0.26.1, 0.25.2 (as shown above), 0.25.1, or 0.25.
The full output of python -m pip install kivy after installing Cython 0.25.2 is here: https://pastebin.com/iWtfdzYZ (the paste name incorrectly says Kivy 1.10.1--pip actually does get 1.10.0 as shown in the output.
using:
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
GNU Make 4.2.1
autoconf (GNU Autoconf) 2.69
Python 2.7.14
@expertmm See https://github.com/kivy/kivy/pull/5459 for more about this error, basically you need to install from master branch or lower the sdl2_mixer version :)
I took the following steps to make it work on Fedora 27:
dnf install SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel
dnf install @development-tools
dnf install python2-devel
dnf install portmidi-devel zlib-devel
wget https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-27.noarch.rpm
wget https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-27.noarch.rpm
dnf install rpmfusion-free-release-27.noarch.rpm
dnf install rpmfusion-nonfree-release-27.noarch.rpm
dnf install ffmpeg ffmpeg-libs
# base and good plugins already installed
dnf install gstreamer1-devel
dnf install mesa-libGL-devel
# install as an ordinary user
pip install --user Cython==0.23
# kivy 1.10.1 fails to compile with SDL2-mixer 2.0.2.
# have to use the development version of kivy.
pip install --user https://github.com/kivy/kivy/archive/master.zip
Cool! I'll try it and I can help edit https://github.com/kivy/kivy/blob/master/doc/sources/installation/installation-linux.rst by adding your instructions and my Fedora 26 instructions and submit pull request as suggested.
@freemant2000 Thanks.
Tested and working on clean install of Fedora 27 KDE, after installing wget. Kivy installs successfully, and runs kivy app KivySpinningBunnies.
NOTE: wget is not installed by default for some reason (and was not a dependency of anything installed here), so had to first do:
dnf install wget
(then your solution worked)
I tested the steps I posted above, this time on Fedora 28, then submitted a documentation pull request here: https://github.com/kivy/kivy/pull/5879
PR merged, i'm closing this one
Most helpful comment
Cool! I'll try it and I can help edit https://github.com/kivy/kivy/blob/master/doc/sources/installation/installation-linux.rst by adding your instructions and my Fedora 26 instructions and submit pull request as suggested.