HOW-TO:Upgrade Python interpreter on Linux

From Official Kodi Wiki
Jump to: navigation, search
Home icon grey.png   ▶ Development ▶ Add-on development ▶ Python development ▶ HOW-TO:Upgrade Python interpreter on Linux
Emblem-important-yellow.png NOTICE:
This is for Linux only. Other platforms uses a built-in Python interpreter shipped with Kodi.

If you have TLS-handshake errors with some plugin(s) in Kodi under Linux, this page is for you. The problem is caused by an outdated system-wide Python 2 interpreter installed on your system. Some users may instinctively attempt to upgrade the system-wide Python interpreter, from source, from a PPA, using a third-party package manager or whatever. Do not do that! Python is an integral part of many distributions, including Ubuntu, and messing with the vendor-supplied interpreter may cause all kinds of problems. This method uses Miniconda and a modified environment to launch Kodi with it's very own, updated Python interpreter.

1 Procedure

Note: This procedure is tested on Ubuntu 14.04 LTS

1.1 Prerequisites

  • Miniconda. To download and install follow the instructions here.
  • BlueZ development files to compile PyBluez. Install with
$ sudo apt-get install libbluetooth-dev

1.2 Create the environment

$ conda create --name kodi python=2.7
$ source activate kodi
(kodi) $ conda install simplejson pillow
(kodi) $ pip install PyBluez PIL-compat
(kodi) $ source deactivate

1.3 Launch Kodi

$ env PATH="/<path>/<to>/<miniconda>/envs/kodi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" LD_LIBRARY_PATH="/<path>/<to>/<miniconda>/envs/kodi/lib" kodi

(obviously replace "/<path>/<to>/<miniconda>" with wherever you installed miniconda)

1.3.1 Modify the .desktop-file (optional)

You can also put the above command inside your .desktop-file to enable launching directly from your desktop environment.

$ mkdir -p ~/.local/share/applications
$ x="/<path>/<to>/<miniconda>/envs/kodi"
$ sed 's|Exec=kodi|Exec=env PATH="'"${x}"'/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" LD_LIBRARY_PATH="'"${x}"'/lib" kodi|g' /usr/share/applications/kodi.desktop > ~/.local/share/applications/kodi.desktop

2 See also

Attention talk.png Original forum post