2015-10-09 02:55:05 +00:00
|
|
|
.. _installation_osx:
|
2012-03-23 01:22:05 +00:00
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
Installation on OS X
|
2017-01-02 20:01:25 +00:00
|
|
|
====================
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2018-02-24 22:14:33 +00:00
|
|
|
This guide describes multiple ways for setting up Kivy.
|
2017-01-02 20:01:25 +00:00
|
|
|
|
2018-07-17 19:24:10 +00:00
|
|
|
Using Wheels
|
|
|
|
------------
|
|
|
|
|
|
|
|
Wheels are precompiled binaries for the specific platform you are on.
|
2019-05-30 23:01:31 +00:00
|
|
|
All you need to do to install Kivy using wheels on osx is ::
|
2018-07-17 19:24:10 +00:00
|
|
|
|
|
|
|
$ python -m pip install kivy
|
2019-03-06 23:01:53 +00:00
|
|
|
|
2019-05-26 04:55:47 +00:00
|
|
|
Gstreamer is not included, so if you would like to use media playback with kivy,
|
|
|
|
you should install `ffpyplayer` like so ::
|
2018-07-17 19:31:52 +00:00
|
|
|
|
|
|
|
$ python -m pip install ffpyplayer
|
|
|
|
|
|
|
|
Make sure to set `KIVY_VIDEO=ffpyplayer` env variable before running the app.
|
|
|
|
|
2019-05-30 23:01:31 +00:00
|
|
|
Nightly wheel installation
|
2020-09-16 01:50:34 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2019-05-30 23:01:31 +00:00
|
|
|
|
|
|
|
.. warning::
|
|
|
|
|
|
|
|
Using the latest development version can be risky and you might encounter
|
|
|
|
issues during development. If you encounter any bugs, please report them.
|
|
|
|
|
|
|
|
Snapshot wheels of current Kivy master are created daily on the
|
2020-09-16 01:50:34 +00:00
|
|
|
``master`` branch of kivy repository. You can install wheels with::
|
2018-07-17 19:24:10 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
pip install kivy[base] kivy_examples --pre --extra-index-url https://kivy.org/downloads/simple/
|
2018-07-17 19:25:56 +00:00
|
|
|
|
2019-05-30 23:01:31 +00:00
|
|
|
Using Conda
|
|
|
|
-----------
|
|
|
|
|
|
|
|
If you use Anaconda, you can simply install kivy using::
|
|
|
|
|
|
|
|
$ conda install kivy -c conda-forge
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
.. _osx-run-app:
|
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
Using The Kivy.app
|
|
|
|
------------------
|
|
|
|
|
2011-02-01 10:24:24 +00:00
|
|
|
.. note::
|
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
These instructions apply only from Kivy v2.0.0 onwards.
|
2019-05-30 23:01:31 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
.. note::
|
2015-07-07 16:17:20 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
Kivy.app is built on the `current GitHub Action macOS version
|
|
|
|
<https://github.com/actions/virtual-environments#available-environments>`_ and will typically
|
|
|
|
not work on older OS X versions. For older OS X versions, you need to build Kivy.app
|
|
|
|
on the oldest machine you wish to support. See below.
|
2015-07-07 16:17:20 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
For OS X 10.14.4+ and later, we provide a Kivy DMG with all dependencies
|
|
|
|
bundled in a **virtual environment**, including a Python interpreter. This is
|
|
|
|
primarily useful for packaging Kivy applications.
|
2015-07-17 07:08:15 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
You can find complete instructions to build and package apps with Kivy.app in the readme
|
|
|
|
of the `kivy-sdk-packager repo <https://github.com/kivy/kivy-sdk-packager/tree/master/osx>`_.
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
To install the Kivy virtualenv, you must:
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
1. Navigate to the latest Kivy release on Kivy's `website <https://kivy.org/downloads/>`_ or
|
|
|
|
`GitHub <https://github.com/kivy/kivy/releases>`_ and download ``Kivy.dmg``.
|
|
|
|
You can also download a nightly snapshot of
|
|
|
|
`Kivy.app <https://kivy.org/downloads/ci/osx/app/Kivy.dmg>`_.
|
|
|
|
2. Open the dmg
|
|
|
|
3. In the GUI copy the Kivy.app to /Applications by dragging the folder icon to the right.
|
|
|
|
4. Optionally create a symlink by running the following command::
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
``ln -s /Applications/Kivy.app/Contents/Resources/script /usr/local/bin/kivy``
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
This creates the ``kivy`` binary that you can use instead of python to run scripts.
|
|
|
|
I.e. instead of doing ``python my_script.py`` or ``python -m pip install <module name>``, write
|
|
|
|
``kivy my_script.py`` or ``kivy -m pip install <module name>`` to run it using the kivy
|
|
|
|
bundled Python interpreter with the kivy environment.
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
As opposed to activating the virtualenv below, running with ``kivy`` will use the virtualenv
|
|
|
|
but also properly configure the script environment required to run a Kivy app (i.e. setting
|
|
|
|
kivy's home path etc.).
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
Using the App Virtual environment
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
The path to the underlying virtualenv is ``/Applications/Kivy.app/Contents/Resources/venv``.
|
|
|
|
To activate it so you can use python, like any normal virtualenv, do::
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
pushd /Applications/Kivy.app/Contents/Resources/venv/bin
|
|
|
|
source activate
|
|
|
|
source kivy_activate
|
|
|
|
popd
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
On the default mac (zsh) shell you **must** be in the bin directory containing ``activate`` to be
|
|
|
|
able to ``activate`` the virtualenv, hence why we changed the directory temporarily.
|
2015-12-28 19:25:54 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
``kivy_activate`` sets up the environment to be able to run Kivy, by setting the kivy home,
|
|
|
|
gstreamer, and other variables.
|
2013-04-18 23:50:55 +00:00
|
|
|
|
2011-02-01 20:02:01 +00:00
|
|
|
Start any Kivy Application
|
2015-10-09 02:55:05 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2011-02-01 10:24:24 +00:00
|
|
|
|
|
|
|
You can run any Kivy application by simply dragging the application's main file
|
2020-09-16 01:50:34 +00:00
|
|
|
onto the Kivy.app icon.
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
Using Homebrew with pip
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
You can install Kivy with Homebrew and pip using the following steps:
|
|
|
|
|
|
|
|
1. Install the requirements using `homebrew <http://brew.sh>`_::
|
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer python3
|
2019-05-30 23:01:31 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
2. Install Kivy using pip::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ python3 -m pip install --no-binary kivy kivy[base]
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
To install the development version, use this in the second step::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ python3 -m pip install "kivy[base] @ https://github.com/kivy/kivy/archive/master.zip"
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
Using MacPorts with pip
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
You will have to manually install gstreamer support if you wish to
|
|
|
|
support video playback in your Kivy App. The latest port documents show the
|
|
|
|
following `py-gst-python port <https://trac.macports.org/ticket/44813>`_.
|
|
|
|
|
|
|
|
You can install Kivy with Macports and pip using the following steps:
|
|
|
|
|
|
|
|
1. Install `Macports <https://www.macports.org>`_
|
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
2. Install and set Python 3.8 as the default::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ port install python38
|
|
|
|
$ port select --set python python38
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
3. Install and set pip as the default::
|
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ port install py38-pip
|
|
|
|
$ port select --set pip py38-pip
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
4. Install the requirements using `Macports <https://www.macports.org>`_::
|
|
|
|
|
|
|
|
$ port install libsdl2 libsdl2_image libsdl2_ttf libsdl2_mixer
|
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
2. Install Kivy using pip::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ python3 -m pip install --no-binary kivy kivy[base]
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
To install the development version, use this in the second step::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2020-09-16 01:50:34 +00:00
|
|
|
$ python3 -m pip install "kivy[base] @ https://github.com/kivy/kivy/archive/master.zip"
|