Archive:Upgrade Python interpreter on Linux: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Created page with "{{mininav|Development|Add-on development|Python development}} {{Notice|This is for Linux only. Other platforms uses a built-in Python interpreter shipped with Kod...")
 
(→‎Launch Kodi: fix typo)
Line 29: Line 29:
</syntaxhighlight>
</syntaxhighlight>


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


==== Modify the .desktop-file (optional) ====
==== Modify the .desktop-file (optional) ====

Revision as of 13:57, 4 April 2017

Home icon grey.png   ▶ Development ▶ Add-on development ▶ Python development ▶ 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.

Procedure

Note: This procedure is tested on Ubuntu 14.04 LTS

Prerequisites

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

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

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)

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

See also

Attention talk.png Original forum post