KivyInstaller

_images/logo.png

It ships Kivy right to you!

Everyone can mess things up even with simple installation or update. In version 1.8.0 there was a batch file for making things easier for beginners or regular users, but this file disappeared as the wheel came in. KivyInstaller is inspired by this kivy.bat file from old portable package with multiple new functions.

KivyInstaller provides:

  • Installing Python (even for non-admin!)
  • Installing & updating Kivy
  • Switching between Kivy stable and master branch
  • Updating itself
  • Packaging Kivy application for Windows:
    • Test package
    • Full package
  • Removing whole Kivy & Python installation
  • And more…

Contents

Getting started

Note

This batch isn’t by default meant for compiling, however it provides commands to download one of GCC of MSVC tools that can be used for compiling later.

KivyInstaller works with pip and gets Kivy from .whl files. It supports 32bit and 64bit Python versions, so you can easily download the one you need.

The complete installation of Python with Kivy master branch takes approximately 3 minutes (even less!) of automated process. This video will surely convince you.

Of course the installation highly depends on your machine, internet speed and connection.

Defaults

  • Python versions 2.7.13, 3.5.2
  • kivy-master 1.10.1
  • kivy-stable is from pypi

Since version 3.3 you are able to change the defaults from the console before actually running the kivy.bat script this way:

set cp3=cp35      # or cp34 or cp36
set cp2=cp27      # shouldn't be necessary to change
set py3=3.5.2     # check on python website if the version exists!
set py2=2.7.13    # same here
set master=1.10.1 # check on Kivy installation page for Windows

or change them freely inside the batch file if you need. Kivy master version shouldn’t really need to be changed anyway as I’ll switch manually the value when there’s a new version for master branch.

Admin installation catch

With MSI installers there’s one catch. Each of them has a Product code for various reasons. For KivyInstaller it means you can install Python from the same installer that requires admin rights only once.

MSI basically creates some stuff in registry for your Python installation including copy-pasting its Product code. With each attempt to install with the same installer it looks for the Product code in registry before installing, therefore if the same Product code is found, it’ll behave as a repair / remove tool for your Python.

Note

There’s an option to change Product code with some free tools and install Python manually with modified .msi.

Multiple Pythons

Product code of MSI installers doesn’t affect having Python 2 and Python 3 at the same time in separate folders.

Using lower / higher version is a workaround for the MSI catch, i.e. if 2.7.11 is installed, the another allowed version would be for example 2.7.10.

You have to change the version in kivy.bat’s variable directly.

Non-admin installation

When installation without admin rights is chosen, there is no limitation for the same Python version on a single OS, yet a glitch may appear during the installation such as leaving some Python stuff inside kivy folder.

If the files / folders left behind are only Doc or tcl, just copy&paste them. Otherwise remove everything except kivy.bat and .msi, then reinstall.

Note

It may occur that MSI installer becames broken for non-admin type of installation. In this case the installer needs to be completely removed and redownloaded.

Warning

This type of installation since Python 3.5.0 leaves a trace in Programs and Features as a casual installed application, but doesn’t require admin privileges. When this issue is fixed, the warning will be removed.

Usage

This section explains how to install Kivy on any Windows from scratch and how to use existing python installation as a base for KivyInstaller.

For more details use kivy help after successful installation.

Installation

  1. Create a folder for your Python and place kivy.bat inside.

    • Alternatively, clone whole KivyInstaller repo and Python will be installed there. git clone https://github.com/KeyWeeUsr/KivyInstaller

    • Or use command line instructions:

      mkdir python
      bitsadmin /transfer "GetBatch" "https://git.io/vDDjn" "%cd%\python\kivy.bat"
      cd python
      
  2. Run kivy.bat and select your Python and Kivy versions.

    • To select y/n you have to type and press enter (return).
  3. Enjoy!

kivy.bat after successful installation behaves as a normal cmd.exe console with all important stuff set.

If cloned from repo and installed as non-admin, git clean -dxf returns the clone to its original state (removes installation).

Note

You can delete .msi after installation. KivyInstaller will download the .msi file if there’s no available when needed.

Install to existing Python

  1. Copy/clone kivy.bat to your folder with python.exe and run it.
  2. Choose your installed Python architecture version (32bit / 64bit).
  3. Select which Python is installed (2.x / 3.x).
  4. Best to ignore registering extensions with n answer. It won’t work anyway because Python is already installed.
  5. Choose Kivy version.
  6. Enjoy!

Note

If you plan to use all features of KivyInstaller(kivy uninstall mainly), you need to change Python version(py2/py3) in config file to the same version you use. Otherwise it may cripple your Python with the uninstall option.

Update

KivyInstaller uses Kivy wheels for installation:

To update already installed Kivy use one of these commands:

kivy update
kivy updatemaster

To update KivyInstaller to the latest version use kivy batupdate. The batch will automatically download the new version and back up the current one to backup_kivy.bat file. If the update fails, replace kivy.bat with the backup file.

Pack

Since version 1.3 KivyInstaller provides a quick way to create a package for Windows with --debug option on to test if packaging Kivy works.

kivy pack "<path>"

This way doesn’t support other options such as --name or --icon and it is only for debugging. The name of .exe file is taken from the parent folder of .py file.

Note

For more options use pyinstaller directly.

Uninstall

There’s an option to remove Python with Kivy and other installed packages + cached pip files. However, this option works only if the whole path to folder with Python is the same as used during installation - i.e. it partially relies on MSI Python installer.

Another option is using kivy remove command to remove Kivy installation only. The conditions are the same as for previous option.

Features

This section shows all available packages after successful installation together with features the KivyInstaller provides.

Packages

  • docutils
  • Kivy-Garden
  • pip
  • Pygments
  • PyInstaller
  • pypiwin32
  • requests
  • setuptools
  • wget
  • wheel

Extra packages

There are optional packages you may want to install later (see kivy help command), however compilers need some post-install editing, otherwise they won’t work with Kivy. A command for installing compiler also opens a documentation page related to the chosen compiler if available:

  • Kivy Designer
  • MinGWPy (GCC)
  • Visual C++ 9.0 standalone compiler (MSVC)
  • Visual C++ 10.0 standalone SDK (MSVC)
  • Visual C++ 14.0 Build Tools 2015 (MSVC)

Extra PATH

Since 1.4 there is a new empty file extrapath.kivyinstaller available that provides a user an easy way to extend PATH without using set command manually on each run of cmd.exe or edit environment variables.

The PATH from extrapath file will be also available in every shortcut i.e. Quick Launch, Send To, even Taskbar if you create shortcut for it manually.

Usage

Just paste a new path as it is, without quotes or any other extra characters into the file. The path separator for Windows is a backslash (\).

Example:

C:\Users\John

For more paths, separate them with semicolon as in casual PATH setting:

C:\Users\John;C:\Users\Guest

Do not end the line with a semicolon or write multiple lines. The file works in a single line mode.

Shortcuts

There’s an option to allow creating shortcuts for your installation. Those will be placed into two locations: Send to and Quick Launch.

Running .py file with Send to option works on WinXP and higher, however taskbar shortcut works only on WinXP and WinVista. The taskbar item runs either as a console, or uses a file that can be drag&dropped to it. The shortcut will run the file directly as if python.exe was called.

Useful for running snippets of code from your desktop. Shortcuts are removed together with all other data after kivy uninstall.

Win7+

On Windows 7 and higher the taskbar has a different functionality than original Quick Launch, therefore a bad workaround is to drag&drop a manually created shortcut for kivy.bat to the taskbar, however script drag&dropping won’t work this way.

To make drag&dropping work, re-enable Quick Launch in your system.

Troubleshooting

This section provides solutions to the known problems a user could encounter while using the KivyInstaller.

Known problems

  • Can’t download Python .msi - probably missing bitsadmin, run cmd and bitsadmin. If available and still not downloading, report an issue.
  • Python installation doesn’t work - report an issue with msi.log from your folder.
  • w9xpopen.exe error - Python .msi installer is broken. Delete it, KivyInstaller will download a fresh one.
  • Whatever “Internet security” error for nul and extrapath displayed in the details is not an error. The statement only makes an empty file for an extra path, ignore it.
  • msvcr100.dll is missing. You need to download it.
  • Python 3.5+ installation fails on stock: Windows Vista, Windows 7, probably even on Windows 8. On Windows 7 you’ll need at least Service Pack 1 with its updates. Similar updates related stuff applies for Vista and 8.
  • Bitsadmin didn’t finish the downloading correctly and threw some error in HEX such as Unable to complete job - 0x80200002. See BITS Return Values.

Report an issue

If you experience any problems, report an issue in the github repo.

Indices and tables