File "/home/username/.local/lib/python3.7/site-packages/kodi_cli.py", line 3, in import importlib.metadata ModuleNotFoundError: No module named 'importlib.metadata'
pip3 install kodi-cli --user
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: kodi-cli in /home/username/.local/lib/python3.7/site-packages (0.1.9) Requirement already satisfied: requests<3.0.0,>=2.28.0 in /home/username/.local/lib/python3.7/site-packages (from kodi-cli) (2.28.1) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.28.0->kodi-cli) (1.24.1) Requirement already satisfied: charset-normalizer<3,>=2 in /home/username/.local/lib/python3.7/site-packages (from requests<3.0.0,>=2.28.0->kodi-cli) (2.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.28.0->kodi-cli) (2018.8.24) Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests<3.0.0,>=2.28.0->kodi-cli) (2.6)
kodi-cli -H host -P 8080 -u username -p password -C
I got the error at top so..
pip3 install importlib-metadata --user
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: importlib-metadata in /home/username/.local/lib/python3.7/site-packages (5.0.0) Requirement already satisfied: zipp>=0.5 in /home/username/.local/lib/python3.7/site-packages (from importlib-metadata) (3.10.0) Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /home/username/.local/lib/python3.7/site-packages (from importlib-metadata) (3.10.0.0)
Still get the error.
python3 --version
Python 3.7.3
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
I'm scratching my head here. Any help would be appreciated.
I suspect it might have to do with this code in the program kodi_cli.py
import importlib.metadata
import json
import logging
import os
import pathlib
import sys
import textwrap
import version as ver_info
from kodi_interface import KodiObj
__version__ = importlib.metadata.version("kodi-cli")
I just followed what @cory-gross said in the comment and it worked for me. very minor detail indeed.
"python 3.8 and up use importlib.metadata and below python 3.8 uses importlib_metadata."
so in my case it became:
from importlib_metadata import packages_distributions
packages_distributions() # I wanted to see all distribution names and their import names