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
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
.. |cp35_osx| replace:: Python 3.5
|
|
|
|
.. _cp35_osx: https://kivy.org/downloads/ci/osx/kivy/Kivy-2.0.0.dev0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
|
|
|
|
.. |cp36_osx| replace:: Python 3.6
|
|
|
|
.. _cp36_osx: https://kivy.org/downloads/ci/osx/kivy/Kivy-2.0.0.dev0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
|
|
|
|
.. |cp37_osx| replace:: Python 3.7
|
|
|
|
.. _cp37_osx: https://kivy.org/downloads/ci/osx/kivy/Kivy-2.0.0.dev0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
|
|
|
|
.. |examples_whl_osx| replace:: Kivy examples
|
|
|
|
.. _examples_whl_osx: https://kivy.org/downloads/appveyor/kivy/Kivy_examples-2.0.0.dev0-py2.py3-none-any.whl
|
|
|
|
|
|
|
|
.. 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
|
|
|
|
`master` branch of kivy repository. They can be found
|
|
|
|
`here <https://kivy.org/downloads/ci/osx/kivy/>`_. To use them, instead of
|
|
|
|
doing ``python -m pip install kivy`` we'll install one of these wheels as
|
|
|
|
follows.
|
|
|
|
|
|
|
|
- |cp35_osx|_
|
|
|
|
- |cp36_osx|_
|
|
|
|
- |cp37_osx|_
|
2018-07-17 19:24:10 +00:00
|
|
|
|
2019-05-30 23:01:31 +00:00
|
|
|
#. Download the appropriate wheel for your Python version.
|
|
|
|
#. Install it with ``python -m pip install wheel-name`` where ``wheel-name``
|
|
|
|
is the name of the file.
|
2018-07-17 19:25:56 +00:00
|
|
|
|
2019-05-30 23:01:31 +00:00
|
|
|
Kivy examples are separated from the core because of their size. The examples
|
|
|
|
can be installed separately on all Python versions with this single wheel:
|
2018-07-17 19:25:56 +00:00
|
|
|
|
2019-05-30 23:01:31 +00:00
|
|
|
- |examples_whl_osx|_
|
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
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
Using The Kivy.app
|
|
|
|
------------------
|
|
|
|
|
2011-02-01 10:24:24 +00:00
|
|
|
.. note::
|
|
|
|
|
2015-12-28 19:25:54 +00:00
|
|
|
This method has only been tested on OS X 10.7 and above (64-bit).
|
2013-12-22 12:27:01 +00:00
|
|
|
For versions prior to 10.7 or 10.7 32-bit, you have to install the
|
2018-06-17 16:41:31 +00:00
|
|
|
components yourself.
|
2014-04-16 20:45:03 +00:00
|
|
|
|
2019-03-06 23:01:53 +00:00
|
|
|
For OS X > 10.13.5 and later, we provide packages with all dependencies
|
2018-02-24 22:14:33 +00:00
|
|
|
bundled in a virtual environment, including a Python interpreter for
|
|
|
|
python3 version. These bundles are primarily used for rapid prototyping,
|
2017-01-02 20:01:25 +00:00
|
|
|
and currently serve as containers for packaging Kivy apps with Buildozer.
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2011-02-01 20:02:01 +00:00
|
|
|
To install Kivy, you must:
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2017-02-19 21:57:43 +00:00
|
|
|
1. Navigate to the latest Kivy release at
|
2018-02-24 22:14:33 +00:00
|
|
|
https://kivy.org/downloads/ and download `Kivy-*-osx-python*.dmg`.
|
|
|
|
2. Open the dmg
|
|
|
|
3. Copy the Kivy.app to /Applications.
|
2019-03-15 08:05:46 +00:00
|
|
|
4. Create a symlink by running the `makesymlinks` in the window that opens when you open the dmg.
|
2019-05-30 23:01:31 +00:00
|
|
|
|
2019-03-15 08:05:46 +00:00
|
|
|
If you have trouble running this script, you can try right-click->Open or just add the link manually
|
|
|
|
by running the following command::
|
2019-03-15 08:56:55 +00:00
|
|
|
`sudo ln -s /Applications/Kivy<version>/Contents/Resources/script /usr/local/bin/kivy<version>`
|
2019-03-15 08:05:46 +00:00
|
|
|
version is either 2/3 based on which version of the app did you download.
|
2019-05-30 23:01:31 +00:00
|
|
|
|
2016-01-07 19:51:01 +00:00
|
|
|
5. Examples and all the normal kivy tools are present in the Kivy.app/Contents/Resources/kivy directory.
|
|
|
|
|
|
|
|
You should now have a `kivy` script that you can use to launch your kivy app from the terminal.
|
2019-05-16 18:09:03 +00:00
|
|
|
You might need to add `/usr/local/bin` to your path::
|
2015-07-07 09:40:36 +00:00
|
|
|
|
2019-05-16 18:09:03 +00:00
|
|
|
export PATH=/usr/local/bin:$PATH
|
|
|
|
|
|
|
|
You can just drag and drop your main.py onto the kivy icon to run your app too.
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2015-07-07 16:17:20 +00:00
|
|
|
Installing modules
|
2015-10-09 02:55:05 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~
|
2015-07-07 16:17:20 +00:00
|
|
|
|
2016-01-07 19:51:01 +00:00
|
|
|
The Kivy SDK on OS X uses its own virtual env that is activated when you run your app using the `kivy` command.
|
2015-07-07 16:17:20 +00:00
|
|
|
To install any module you need to install the module like so::
|
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
$ kivy -m pip install <modulename>
|
2015-07-17 07:08:15 +00:00
|
|
|
|
2015-12-28 19:25:54 +00:00
|
|
|
Where are the modules/files installed?
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-01-07 19:51:01 +00:00
|
|
|
Inside the portable venv within the app at::
|
2015-12-28 19:25:54 +00:00
|
|
|
|
|
|
|
Kivy.app/Contents/Resources/venv/
|
|
|
|
|
2016-01-07 19:51:01 +00:00
|
|
|
If you install a module that installs a binary for example like kivy-garden.
|
2015-12-28 19:25:54 +00:00
|
|
|
That binary will be only available from the venv above, as in after you do::
|
|
|
|
|
|
|
|
kivy -m pip install kivy-garden
|
|
|
|
|
2016-01-23 16:35:13 +00:00
|
|
|
The garden lib will be only available when you activate this env::
|
2015-12-28 19:25:54 +00:00
|
|
|
|
|
|
|
source /Applications/Kivy.app/Contents/Resources/venv/bin/activate
|
|
|
|
garden install mapview
|
|
|
|
deactivate
|
|
|
|
|
|
|
|
To install binary files
|
2016-06-19 05:51:40 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
2015-12-28 19:25:54 +00:00
|
|
|
|
|
|
|
Just copy the binary to the /Applications/Kivy.app/Contents/Resources/venv/bin/ directory.
|
|
|
|
|
2016-01-07 19:51:01 +00:00
|
|
|
To include other frameworks
|
2015-12-28 19:25:54 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Kivy.app comes with SDL2 and Gstreamer frameworks provided.
|
2016-01-07 19:51:01 +00:00
|
|
|
To include frameworks other than the ones provided do the following::
|
2015-12-28 19:25:54 +00:00
|
|
|
|
|
|
|
git clone http://github.com/tito/osxrelocator
|
|
|
|
export PYTHONPATH=~/path/to/osxrelocator
|
|
|
|
cd /Applications/Kivy.app
|
|
|
|
python -m osxrelocator -r . /Library/Frameworks/<Framework_name>.framework/ \
|
|
|
|
@executable_path/../Frameworks/<Framework_name>.framework/
|
|
|
|
|
|
|
|
Do not forget to replace <Framework_name> with your framework.
|
|
|
|
This tool `osxrelocator` essentially changes the path for the
|
|
|
|
libs in the framework such that they are relative to the executable
|
2016-01-07 19:51:01 +00:00
|
|
|
within the .app, making the Framework portable with the .app.
|
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
|
2013-04-13 06:33:13 +00:00
|
|
|
onto the Kivy.app icon. Just try this with any python file in the examples folder.
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2015-11-21 17:16:53 +00:00
|
|
|
.. _osx-run-app:
|
2011-02-03 15:02:23 +00:00
|
|
|
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
Start from the Command Line
|
2015-10-09 02:55:05 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2011-02-01 10:24:24 +00:00
|
|
|
|
2011-02-01 20:02:01 +00:00
|
|
|
If you want to use Kivy from the command line, double-click the ``Make Symlinks`` script
|
2013-04-13 06:33:13 +00:00
|
|
|
after you have dragged the Kivy.app into the Applications folder. To test if it worked:
|
|
|
|
|
|
|
|
#. Open Terminal.app and enter::
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
$ kivy
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
You should get a Python prompt.
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
#. In there, type::
|
|
|
|
|
2014-01-11 01:07:01 +00:00
|
|
|
>>> import kivy
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
If it just goes to the next line without errors, it worked.
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2011-02-01 20:02:01 +00:00
|
|
|
#. Running any Kivy application from the command line is now simply a matter
|
2013-04-13 06:33:13 +00:00
|
|
|
of executing a command like the following::
|
2015-10-09 02:55:05 +00:00
|
|
|
|
2013-04-13 06:33:13 +00:00
|
|
|
$ kivy yourapplication.py
|
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>`_::
|
|
|
|
|
|
|
|
$ brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer
|
|
|
|
|
2018-06-17 16:41:31 +00:00
|
|
|
2. Install Cython and Kivy using pip:
|
2019-05-30 23:01:31 +00:00
|
|
|
|
2018-06-17 16:41:31 +00:00
|
|
|
.. parsed-literal::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2018-06-17 16:41:31 +00:00
|
|
|
$ pip install |cython_install|
|
|
|
|
$ pip install kivy
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
- To install the development version, use this in the second step::
|
|
|
|
|
|
|
|
$ pip install https://github.com/kivy/kivy/archive/master.zip
|
|
|
|
|
|
|
|
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>`_.
|
|
|
|
|
2018-03-21 12:36:20 +00:00
|
|
|
You can install Kivy with macports only:
|
|
|
|
|
|
|
|
1. Install `Macports <https://www.macports.org>`_
|
2018-06-17 16:41:31 +00:00
|
|
|
|
2018-03-21 12:36:20 +00:00
|
|
|
2. Choose python versions for Kivy, available version 2.7, 3.5, 3.6
|
2018-06-17 16:41:31 +00:00
|
|
|
|
2018-03-21 12:36:20 +00:00
|
|
|
$ port install py35-kivy # for python 3.5
|
|
|
|
$ port install py36-kivy # for python 3.6
|
2018-06-17 16:41:31 +00:00
|
|
|
|
2018-03-21 12:36:20 +00:00
|
|
|
3. Check if kivy is available
|
2018-06-17 16:41:31 +00:00
|
|
|
|
2018-03-21 12:36:20 +00:00
|
|
|
$ python3.5
|
|
|
|
$ >>> import kivy
|
|
|
|
|
2018-02-24 22:14:33 +00:00
|
|
|
You can install Kivy with Macports and pip using the following steps:
|
|
|
|
|
|
|
|
1. Install `Macports <https://www.macports.org>`_
|
|
|
|
|
|
|
|
2. Install and set Python 3.4 as the default::
|
|
|
|
|
|
|
|
$ port install python34
|
|
|
|
$ port select --set python python34
|
|
|
|
|
|
|
|
3. Install and set pip as the default::
|
|
|
|
|
|
|
|
$ port install pip-34
|
|
|
|
$ port select --set pip pip-34
|
|
|
|
|
|
|
|
4. Install the requirements using `Macports <https://www.macports.org>`_::
|
|
|
|
|
|
|
|
$ port install libsdl2 libsdl2_image libsdl2_ttf libsdl2_mixer
|
|
|
|
|
2018-06-17 16:41:31 +00:00
|
|
|
5. Install Cython and Kivy using pip:
|
|
|
|
|
|
|
|
.. parsed-literal::
|
2018-02-24 22:14:33 +00:00
|
|
|
|
2018-06-17 16:41:31 +00:00
|
|
|
$ pip install |cython_install|
|
|
|
|
$ pip install kivy
|
2018-02-24 22:14:33 +00:00
|
|
|
|
|
|
|
- To install the development version, use this in the second step::
|
|
|
|
|
|
|
|
$ pip install https://github.com/kivy/kivy/archive/master.zip
|