Linux Outdated Python version
#1
Hi!

Long story short: I have a problem (TLS-handshake failed) with an addon (Retrospect) that can only be solved by using a newer version of Python. It was my understanding that Kodi uses a built-in Python interpreter, but at least on Linux it seems it uses the system's library. I cannot update Python system-wide since that could cause all sorts of problems, what I would like to do is force Kodi and/or Retrospect to use a local version installed with conda. Anyway to do that? I tried simply activating the conda environment before starting Kodi but that creates even more problems, probably because of mixing Python versions. How does Kodi determine the which Python interpreter and module path to use?

My system is Ubuntu 14.04 LTS which comes with Python 2.7.6.
Reply
#2
like anything else on a unix system - by looking for it in the specified prefixes.
Reply
#3
(2017-02-15, 15:21)ironic_monkey Wrote: like anything else on a unix system - by looking for it in the specified prefixes.

Can you be a bit more specific? As far as I understand conda sets up everything that should be.
Reply
#4
$ ldd /usr/lib/x86_64-linux-gnu/kodi/kodi.bin | grep python
libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f241e59a000)

to make it clear: We link python at compile time, so you either replace your system python, or you have to recompile kodi with your other version
Reply
#5
Right, but if replacing the system version works, then the linking must be dynamic, then shouldn't it be possible to use LD_LIBRARY_PATH to make Kodi link to other locations?
Reply
#6
right, that should work.
Reply
#7
Ok, will try later and report results.
Reply
#8
Success!

After some experimentation found an effective recipe:

First you need miniconda, get it here: https://conda.io/docs/install/quick.html...da-install
Also you need libbluetooth-dev to compile PyBluez.
Code:
$ sudo aptitude install libbluetooth-dev

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

Then start kodi:
Code:
$ 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

Works perfectly so far, retrospect is happy Smile

(obliviously replace "<path>/<to>/<miniconda>" with wherever you installed miniconda)
Reply
#9
I tried the above recipe last night and ran into  "ImportError: cannot import name _remove_dead_weakref" when running a plugin

This page: https://docs.wallaroolabs.com/book/appen...alenv.html
suggests that the problem results from a python path problem in python 2.7.14. Is "conda create --name kodi python=2.7" a wrapper for virtualenv? 
Would the updated syntax be "conda create --name kodi python='which python2.7'"?

This page: https://github.com/anthony-tuininga/cx_F...issues/330
suggests rolling back to python 2.7.13 but the conda environment will not allow this to stick. As soon as I follow the above recipe 2.7.13 upgrades to 2.7.14 

thanks
Reply
#10
(2018-01-31, 22:04)jboehm Wrote: I tried the above recipe last night and ran into  "ImportError: cannot import name _remove_dead_weakref" when running a plugin

This page: https://docs.wallaroolabs.com/book/appen...alenv.html
suggests that the problem results from a python path problem in python 2.7.14. Is "conda create --name kodi python=2.7" a wrapper for virtualenv? 
Would the updated syntax be "conda create --name kodi python='which python2.7'"?

This page: https://github.com/anthony-tuininga/cx_F...issues/330
suggests rolling back to python 2.7.13 but the conda environment will not allow this to stick. As soon as I follow the above recipe 2.7.13 upgrades to 2.7.14 

thanks
No, conda is not a wrapper for virtualenv, altough it performs a similiar function (and much more). Think of it as a much more powerful version of virtualenv that manages python itself as well as python packages and virtual environments. The "python=" argument tells conda which specific version of python to use. I.e. "python=2.7" means the latest version in the 2.7 series. In your case, "python=2.7.13" should lock the version to python 2.7.13.

Conda vs vritualenv command reference
Reply

Logout Mark Read Team Forum Stats Members Help
Outdated Python version1