Solved Trouble upgrading Python for Kodi 19
#1
I've been having trouble loading an add-on, and it seems perhaps that the version of Python is too old.

I've updated Python to 3.8.0, but the problem persists. It seems like Kodi is not(?) using the main Python installation, or else I might(?) need to recompile Kodi, but I have no idea how.

Is there a way to do this without losing all my settings, database content, etc.? Any suggestions?

Details:
Quote:Kodi (19.4 (19.4.0) Git:20220304-e12e66e019). Platform: Linux x86 64-bit
Using Release Kodi x64
Kodi compiled 2022-03-04 by GCC 7.5.0 for Linux x86 64-bit version 4.15.18 (266002)
Running on Ubuntu 18.04.6 LTS, kernel: Linux x86 64-bit version 4.15.0-213-generic
FFmpeg version/source: 4.3.2-Kodi
Quote:$ python3 --version
Python 3.8.0
$ which python3
/usr/bin/python3
$ ls -la /usr/bin/python3
lrwxrwxrwx 1 root root 25 Oct 19 22:55 /usr/bin/python3 -> /etc/alternatives/python3
$ ls -la /etc/alternatives/python3
lrwxrwxrwx 1 root root 18 Oct 19 22:55 /etc/alternatives/python3 -> /usr/bin/python3.8

The Python error, which prevents an add-on dependency from loading:
Quote:from __future__ import annotations
SyntaxError: future feature annotations is not defined

Kodi.log, showing the error in context: https://termbin.com/3gx9d
Reply
#2
AFAIK Kodi does load libpython, no python executable. You can build Kodi in Docker or sbuild/pbuilder (just like for Debian):  https://github.com/tsaarni/docker-deb-builder
Maintainer of Kodi from Debian | Got an issue with Kodi from Debian? Report it here: Kodi from Debian - Support Thread
Reply
#3
Thanks. So, that means Kodi should use the installed latest version of Python (i.e., what is reported by python3 -V)... ?

It is certainly possible that there is something else that needs to be updated to "complete" the Python upgrade for Kodi, but I just don't know what it might be.

As for Docker, I am really not prepared to get into anything like that.
Reply
#4
AFAIK Ubuntu 18.04 LTS has Python 3.6.7 as the system python and applications like kodi will only use the system python
System python cannot be removed or upgraded and so if you want to reliably run Kodi 19 or above you have to move to Ubuntu Focal LTS or better Jammy LTS (22.04.3)
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#5
The problem @mrob is having is trying to load my Kodi Selective Cleaner addon which leverages the Team Kodi supplied MySQL wrapper script .  The problem here is the addon.xml dependency here only requires Python 3.0.0 but the current version of the MySQL script in the Kodi repo leverages a function called "future feature annotations"  which isn't supported until Python 3.7. 

@mrob I think I found an answer.  I found a version of the script.module.myconnpy MySQL connector which does not have the bad call and should work on Kodi 19.  If you look in the addon.xml file under:

/addons/script.module.myconnpy/addon.xml what version is it ?  I suspect it is 8.0.33, which has the issue with Kodi 19 but not Kodi 20 and higher.. 

I found version 8.0.18 on the Kodi repo I had cloned before this script module was updated to 8.0.33.  It is version 8.0.18 and should work on Kodi 19.  I've posted a copy of it on my repository and you can download it here.  
  • I'd uninstall the current version of script.module.myconnpy
  • Download and install the 8.0.18 version from my link
  • Then reload Kodi Selective Cleaner

Let me know if this works.  Once you go to Kodi 20 and higher this shouldn't be an issue since that will be Python 3.8+ .


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#6
(2023-10-22, 01:00)jbinkley60 Wrote: Let me know if this works.  Once you go to Kodi 20 and higher this shouldn't be an issue since that will be Python 3.8+ .


Thanks,

Jeff
You are still thinking Windows & Android. Kodi bundles python only for these platforms. All version of Kodi 19 and above for Windows comes with 3.8.15. And on Android it could be 3.8.15 (Kodi 19) or 3.11.1 (Kodi 20 and 21)
The issue @mrob is having is on Linux where kodi relies on system python. Using ancient unsupported Linux and latest kodi will always have issues. regardless of kodi 19, 20 or 21
Kodi 21 Windows 10 and 11 | 21 Xbox One X | 21 Linux Mint Virginia XFCE | CoreELEC NO 21 nightly S905X4 aarch64
Reply
#7
(2023-10-21, 21:52)gujal Wrote: AFAIK Ubuntu 18.04 LTS has Python 3.6.7 as the system python and applications like kodi will only use the system python
System python cannot be removed or upgraded and so if you want to reliably run Kodi 19 or above you have to move to Ubuntu Focal LTS or better Jammy LTS (22.04.3)

I've upgraded Python before on Linux.  Not on Ubuntu but here's a supposed article.  I've never run Kodi on Linux other than the LibreElec and OSMC builds and wasn't sure if Kodi on Linux has a builtin Python wrapper or leverages the system Python.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#8
ubuntu 18.04 is out of support, you should upgrade to at least 20.04, better yet to 22.04
Reply
#9
Thank you all for these very helpful suggestions.

I've upgraded to Ubuntu 20.04.6 and tried re-installing the add-on, but I am still getting the same error: https://termbin.com/fkrw

Dunno about the status of Python:
Quote:$ python3 --version
Python 3.8.10
$ python --version
Python 2.7.18
What should I try next?
Reply
#10
the problem is that ubuntu provides an outdated kodi version (v19). Since our PPA isn't maintained anymore, you might want to try the flatpak: https://kodi.tv/download/linux/
Reply
#11
Oh... I recall that I had to go through some really convoluted process to install Kodi on Ubuntu server. Sad

Is this upgrade process going to blow away the databases, settings, and add-ons that I've got?
Reply
#12
(2023-10-24, 09:58)mrob Wrote: What should I try next?

There is still something incompatible with script.module.myconnpy v8.0.33 and your setup.  I'd try using version 8.0.18 of this addon I posted and see if it resolves the issue.  It does not appear to have the future annotations Python call, which is causing the issue.  Also disable auto update for this addon, since it will then try to update to 8.0.33, which is in the Kodi repo.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#13
Hi Jeff,

Thanks, I tried installing that script as an add-on and I got a little further.

I can now run the Kodi Selective Cleaner, which wasn't possible before.

However, when I try to use it to backup the video database, I get an error: https://termbin.com/is5o
Reply
#14
(2023-10-24, 10:59)mrob Wrote: Hi Jeff,

Thanks, I tried installing that script as an add-on and I got a little further.

I can now run the Kodi Selective Cleaner, which wasn't possible before.

However, when I try to use it to backup the video database, I get an error: https://termbin.com/is5o

That,'s good news. I am traveling right now and may not be able to look at it for a couple of days. It may be a path or permissions issue.

Do other functions work where you can analyze (not clean, just analyze) your database ? Also is CSV exporting working ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#15
(2023-10-24, 10:59)mrob Wrote: Hi Jeff,

Thanks, I tried installing that script as an add-on and I got a little further.

I can now run the Kodi Selective Cleaner, which wasn't possible before.

However, when I try to use it to backup the video database, I get an error: https://termbin.com/is5o

OK, so this is another Python issue.  Your Kodi 19 must be running an embedded version of Python which is version 3.6.  The SQLite backup command wasn't added until Python v3.7.  I might adjust the addon.xml file to this to avoid this issue with others.  For now you can copy of your MyVideo119.db file, which is essentially what the current backup command does just using SQL commands vs. a file copy.  I'll ponder if I want to try and fix this or just detect the underlying version of Python and note that it isn't available below Python v3.7.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
Trouble upgrading Python for Kodi 190