Quick search

Installation on Linux

Using software packages

For installing distribution relative packages .deb/.rpm/...

Ubuntu / Kubuntu / Xubuntu / Lubuntu (Saucy and above)

  1. Add one of the PPAs as you prefer

    stable builds:$ sudo add-apt-repository ppa:kivy-team/kivy
    nightly builds:$ sudo add-apt-repository ppa:kivy-team/kivy-daily
  2. Update your packagelist using your package manager

  3. Install Kivy

    Python2 - python-kivy:
     $ sudo apt-get install python-kivy
    Python3 - python3-kivy:
     $ sudo apt-get install python3-kivy
    optionally the examples - kivy-examples:
     $ sudo apt-get install kivy-examples

Debian (Jessie or newer)

  1. Add one of the PPAs to your sources.list in apt manually or via Synaptic

  2. Add the GPG key to your apt keyring by executing

    as user:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A863D2D6

    as root:

    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A863D2D6

  3. Refresh your package list and install python-kivy and/or python3-kivy and optionally the examples found in kivy-examples

Linux Mint

  1. Find out on which Ubuntu release your installation is based on, using this overview.
  2. Continue as described for Ubuntu above, depending on which version your installation is based on.

Bodhi Linux

  1. Find out which version of the distribution you are running and use the table below to find out on which Ubuntu LTS it is based.

    Bodhi 1:Ubuntu 10.04 LTS aka Lucid (No packages, just manual install)
    Bodhi 2:Ubuntu 12.04 LTS aka Precise
    Bodhi 3:Ubuntu 14.04 LTS aka Trusty
  1. Continue as described for Ubuntu above, depending on which version your installation is based on.

OpenSuSE

  1. To install kivy go to http://software.opensuse.org/package/python-Kivy and use the “1 Click Install” for your openSuse version. You might need to make the latest kivy version appear in the list by clicking on “Show unstable packages”. We prefer to use packages by ” devel:languages:python”.
  2. If you would like access to the examples, please select python-Kivy-examples in the upcomming installation wizard.

Fedora

  1. Adding the repository via the terminal:

    Fedora 18

    $ sudo yum-config-manager  --add-repo=http://download.opensuse.org\
    /repositories/home:/thopiekar:/kivy/Fedora_18/home:thopiekar:kivy.repo

    Fedora 17

    $ sudo yum-config-manager --add-repo=http://download.opensuse.org\
    /repositories/home:/thopiekar:/kivy/Fedora_17/home:thopiekar:kivy.repo

    Fedora 16

    $ sudo yum-config-manager --add-repo=http://download.opensuse.org\
    /repositories/home:/thopiekar:/kivy/Fedora_16/home:thopiekar:kivy.repo
  2. Use your preferred package-manager to refresh your packagelists

  3. Install python-Kivy and optionally the examples, as found in python-Kivy-examples

Gentoo

  1. There is a kivy ebuild (kivy stable version)

    emerge Kivy

  2. available USE-flags are:

    cairo: Standard flag, let kivy use cairo graphical libraries. camera: Install libraries needed to support camera. doc: Standard flag, will make you build the documentation localy. examples: Standard flag, will give you kivy examples programs. garden: Install garden tool to manage user maintained widgets. gstreamer: Standard flag, kivy will be able to use audio/video streaming libraries. spell: Standard flag, provide enchant to use spelling in kivy apps.

Installation in a Virtual Environment

Common dependencies

Cython

Different versions of Kivy have only been tested up to a certain Cython version. It may or may not work with a later version.

Kivy Cython
1.8 0.20.2
1.9 0.21.2
1.9.1 0.23

System dependencies with modern SDL2

Ubuntu example

# Install necessary system packages
sudo apt-get install -y \
    python-pip \
    build-essential \
    mercurial \
    git \
    python \
    python-dev \
    ffmpeg \
    libsdl2-dev \
    libsdl2-gfx-dev \
    libsdl2-image-dev \
    libsdl2-mixer-dev \
    libsdl2-net-dev \
    libsdl2-ttf-dev \
    libportmidi-dev \
    libswscale-dev \
    libavformat-dev \
    libavcodec-dev \
    zlib1g-dev

Installation

# Make sure Pip, Virtualenv and Setuptools are updated
sudo pip install --upgrade pip virtualenv setuptools

# Create a virtualenv
virtualenv --no-site-packages kivyinstall

# Enter the virtualenv
. kivyinstall/bin/activate

# Use correct Cython version here
pip install Cython==0.21.2

# Install stable version of Kivy into the virtualenv
pip install kivy
# For the development version of Kivy, use the following command instead
# pip install git+https://github.com/kivy/kivy.git@master

Python 3

If you want to use Python 3 you install “python3” and “python3-dev” and then pass “-p python3” to virtualenv.

Dependencies with legacy PyGame

Ubuntu example

# Install necessary system packages
sudo apt-get install -y \
    python-pip \
    build-essential \
    mercurial \
    git \
    python \
    python-dev \
    ffmpeg \
    libsdl-image1.2-dev \
    libsdl-mixer1.2-dev \
    libsdl-ttf2.0-dev \
    libsmpeg-dev \
    libsdl1.2-dev \
    libportmidi-dev \
    libswscale-dev \
    libavformat-dev \
    libavcodec-dev \
    zlib1g-dev

Fedora

$ sudo yum install \
    make \
    mercurial \
    automake \
    gcc \
    gcc-c++ \
    SDL_ttf-devel \
    SDL_mixer-devel \
    khrplatform-devel \
    mesa-libGLES \
    mesa-libGLES-devel \
    gstreamer-plugins-good \
    gstreamer \
    gstreamer-python \
    mtdev-devel \
    python-devel \
    python-pip

OpenSuse

$ sudo zypper install \
    python-distutils-extra \
    python-gstreamer-0_10 \
    python-enchant \
    gstreamer-0_10-plugins-good \
    python-devel \
    Mesa-devel \
    python-pip
$ sudo zypper install -t pattern devel_C_C++

Installation

# Make sure Pip, Virtualenv and Setuptools are updated
sudo pip install --upgrade pip virtualenv setuptools

# Create a virtualenv
virtualenv --no-site-packages kivyinstall

# Enter the virtualenv
. kivyinstall/bin/activate

pip install numpy

pip install Cython==0.21.2

# If you want to install pygame backend instead of sdl2
# you can install pygame using command below and enforce using
# export USE_SDL2=0. If kivy's setup can't find sdl2 libs it will
# automatically set this value to 0 then try to build using pygame.
pip install hg+http://bitbucket.org/pygame/pygame



# Install stable version of Kivy into the virtualenv
pip install kivy
# For the development version of Kivy, use the following command instead
# pip install git+https://github.com/kivy/kivy.git@master

Install additional Virtualenv packages

# Install development version of buildozer into the virtualenv
pip install git+https://github.com/kivy/buildozer.git@master

# Install development version of plyer into the virtualenv
pip install git+https://github.com/kivy/plyer.git@master

# Install a couple of dependencies for KivyCatalog
pip install -U pygments docutils

Start from the Command Line

We ship some examples that are ready-to-run. However, theses examples are packaged inside the package. This means you must first know where easy_install has installed your current kivy package, and then go to the examples directory:

$ python -c "import pkg_resources; print(pkg_resources.resource_filename('kivy', '../share/kivy-examples'))"

And you should have a path similar to:

/usr/local/lib/python2.6/dist-packages/Kivy-1.0.4_beta-py2.6-linux-x86_64.egg/share/kivy-examples/

Then you can go to the example directory, and run it:

# launch touchtracer
$ cd <path to kivy-examples>
$ cd demo/touchtracer
$ python main.py

# launch pictures
$ cd <path to kivy-examples>
$ cd demo/pictures
$ python main.py

If you are familiar with Unix and symbolic links, you can create a link directly in your home directory for easier access. For example:

  1. Get the example path from the command line above

  2. Paste into your console:

    $ ln -s <path to kivy-examples> ~/
  3. Then, you can access to kivy-examples directly in your home directory:

    $ cd ~/kivy-examples

If you wish to start your Kivy programs as scripts (by typing ./main.py) or by double-clicking them, you will want to define the correct version of Python by linking to it. Something like:

$ sudo ln -s /usr/bin/python2.7 /usr/bin/kivy

Or, if you are running Kivy inside a virtualenv, link to the Python interpreter for it, like:

$ sudo ln -s /home/your_username/Envs/kivy/bin/python2.7 /usr/bin/kivy

Then, inside each main.py, add a new first line:

#!/usr/bin/kivy

NOTE: Beware of Python files stored with Windows-style line endings (CR-LF). Linux will not ignore the <CR> and will try to use it as part of the file name. This makes confusing error messages. Convert to Unix line endings.