Missing Python Module "Crypto"

Hi folks,

Been playing around with a few Kodi addons, and one particular one throws the following Python error. I’ve removed the name of the addon in the following logfile snippet.

2022-04-06 06:25:26.543 T:3134 ERROR : EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<–
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class ‘ModuleNotFoundError’>
Error Contents: No module named ‘Crypto’
Traceback (most recent call last):
File line 19, in
from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named ‘Cryptodome’

                                               During handling of the above exception, another exception occurred:

                                               Traceback (most recent call last):
                                                 File <XXX>, line 22, in <module>
                                                   from Crypto.Cipher import AES
                                               ModuleNotFoundError: No module named 'Crypto'
                                               -->End of Python script error report<--

I’m guessing that the python module is missing. Running a Vero 4K+ however, how would I go about adding in this python module into OSMC ? Also, if that can be done, would updating OSMC require having to add this module in again ?

I guess, a generic question surrounding this would be how would we add a Python module into the OSMC build on a Vero 4K+, and would this be persistent across updates.

Any help would be appreciated on this. Thanx in advance !

Why?

Is this your own add-on?

Otherwise the add-on will supply its own dependencies automatically and you have nothing to worry about.

A simple example: the My OSMC add-on brings in all needed dependencies automatically.

Since i can’t see which version you are running, I can only assume you are running v.19, ergo python3. Seems like you are missing some systemwide python modules:

sudo apt-get install python3-pip python3-crypto
sudo pip3 install setuptools
sudo pip3 install wheel
sudo pip3 install pycryptodome

Should take care of those error messages you have shown in your limited log-output.

Edit: after looking at my own libwidevine-prep script, I realized that all the pip3 lines are replaceable by adding: python3-pycryptodome to the apt-get line.

Edit 2: About upgrade, since we are using Debian python3 apt-packages, when ever Debian updates them so will your system when update is run.

Thanks a bunch @joakim_s , that fixed it !