No module named 'websockets' Debian 11

Bonsoir @Bison,

d’abord un grand merci pour ton travail. Je viens d’installer le plugin sur 2 Jeedom,

  • Pas de soucis sur debian 10.13, jeedom 4.3.17, le daemon à bien démarré.
  • Par contre sur debian 11.7, jeedom 4.3.17, impossible de lancer le daemon, voici le log
Traceback (most recent call last):
File "/var/www/html/plugins/blitzortung/resources/blitzortungd/blitzortungd.py", line 32, in 
import websockets
ModuleNotFoundError: No module named 'websockets'
Error: importing module jeedom.jeedom
Error: importing module jeedom.jeedom

Je reste à disposition pour tout test additionnel.
Bonne soirée,

Mathieu

Salut,

Ah, le genre de truc que j’aime pas du tout :pleading_face::face_with_hand_over_mouth:.

Est-ce que tu peux regarder le log des dépendances parce que là, le package websockets ne s’est pas installé visiblement sur ta Debian 11.

meme erreur (debian 11, jeedom 4.4.0)

0000|+ echo '*******************Begin of package installation******************'
0001|*******************Begin of package installation******************
0002|+ touch /tmp/jeedom_install_in_progress_blitzortung
0003|+ echo 1
0004|+ echo 2
0005|++ awk '$1 <= 4'
0006|++ find /usr/local/lib/python3.9/dist-packages/ -mindepth 1 -maxdepth 1 -type d -exec du -ks '{}' +
0007|++ cut -f 2-
0008|+ RESULTTODELETE=
0009|++ echo ''
0010|++ sed 's, ,\ ,g'
0011|+ RESULTTODELETE2=
0012|+ echo ''
0013|+ xargs rm -rf
0014|+ echo 3
0015|+ sudo pip3 cache purge
0016|Files removed: 5
0017|+ echo 4
0018|+ sudo pip3 install --upgrade pip
0019|Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
0020|Requirement already satisfied: pip in /usr/local/lib/python3.9/dist-packages (23.2.1)
0021|DEPRECATION: gpg 1.14.0-unknown has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
0022|WARNING Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
0023|+ echo 5
0024|+ sudo pip3 install --force-reinstall --upgrade websockets
0025|Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
0026|Collecting websockets
0027|Downloading websockets-11.0.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (130 kB)
0028|━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 130.4/130.4 kB 920.2 kB/s eta 0:00:00
0029|DEPRECATION: gpg 1.14.0-unknown has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
0030|Installing collected packages: websockets
0031|Attempting uninstall: websockets
0032|Found existing installation: websockets 11.0.3
0033|Uninstalling websockets-11.0.3:
0034|Successfully uninstalled websockets-11.0.3
0035|Successfully installed websockets-11.0.3
0036|WARNING Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
0037|+ echo 6
0038|+ php /var/www/html/core/class/../php/jeecli.php plugin dependancy_end blitzortung
0039|+ rm /tmp/jeedom_install_in_progress_blitzortung
0040|+ echo '*******************End of package installation******************'
0041|*******************End of package installation******************

Et voila le log des dépendances :slight_smile:, bon courage.

+ echo '*******************Begin of package installation******************'
*******************Begin of package installation******************
+ touch /tmp/jeedom_install_in_progress_blitzortung
+ echo 1
+ echo 2
++ find /usr/local/lib/python3.9/dist-packages/ -mindepth 1 -maxdepth 1 -type d -exec du -ks '{}' +
++ cut -f 2-
++ awk '$1 <= 4'
+ RESULTTODELETE=
++ echo ''
++ sed 's, ,\ ,g'
+ RESULTTODELETE2=
+ xargs rm -rf
+ echo ''
+ echo 3
+ sudo pip3 cache purge
Files removed: 49
+ echo 4
+ sudo pip3 install --upgrade pip
Requirement already satisfied: pip in /usr/local/lib/python3.9/dist-packages (23.1.2)
Collecting pip
Downloading pip-23.2.1-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 16.9 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 23.1.2
Uninstalling pip-23.1.2:
Successfully uninstalled pip-23.1.2
Successfully installed pip-23.2.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ echo 5
+ sudo pip3 install --force-reinstall --upgrade websockets
Collecting websockets
Downloading websockets-11.0.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.7/129.7 kB 2.6 MB/s eta 0:00:00
DEPRECATION: gpg 1.14.0-unknown has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: websockets
Successfully installed websockets-11.0.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ echo 6
+ php /var/www/html/core/class/../php/jeecli.php plugin dependancy_end blitzortung
+ rm /tmp/jeedom_install_in_progress_blitzortung
+ echo '*******************End of package installation******************'
*******************End of package installation******************

La poisse ces problèmes de dépendances …

Bon, ben là comme ça je vois pas vu que le package s’est bien installé. Il doit y avoir une subtilité sur Debian 11.

Vous pourriez faire un pip3 list | grep websockets quand même histoire de vérifier ?

jeedom@jeedom:~ $ pip3 list | grep websockets
websockets          11.0.3

Ok merci. Et bien pour l’heure j’ai pas d’idées sur le soucis.

J’installerai une Debian 11 pour essayer de trouver comment faire que le module websockets s’import.

Si des expérimentés de python sous Debian 11 ont des expériences, je suis preneur :relaxed:.

Je vais mettre à jour le post de l’actualité du plugin pour indiquer qu’il n’est pas compatible Debian 11.

Ce qui reste etonnant, c est qu il dit qu il le desintall puis le reinstall correctement…

Dans la partie os sur jeedom, ca dit quoi ?

1 « J'aime »

J’ai été surpris aussi de voir ça. C’est la partie packages.json qui gère. J’aurais imaginé qu’il ne ferait pas d’installation si le package existait déjà, d’autant plus dans la même version. Sûrement un truc à remonter à Loïc.

Il doit y avoir un breaking change entre cette version (11.0) et celle que tu as; tu as laquelle?

Je développe sur une 10.13 et ma prod est en 10 également.

Ah pardon la version de websockets, je vérifie.

Dans un premier temps tu devrais faire un venv pour tes dépendances (il y a plusieurs posts dans la section dev où on en parle) et tu peux forcer une version de websocket du coup pour ton plugin, cela devrait fonctionner sur debian 11

Plus tard quand tu auras le temps, tu/on cherchera/s pourquoi.

C’est aussi la
websockets 11.0.3

Du coup pas d’explication sur la version.

J’ai vu pas mal de truc sur les venv mais pas trop penché sur la question. Je pensais que la gestion avec package.json allait m’aider à régler les difficultés des dépendances. Mais non :slightly_frowning_face:.

Bon allez dodo.

C est egalement étonnant que dans ton fichier info tu aies "hasDependency": false mais qu il y ait quand meme une install qui de lance sur les dependances, non …!? :thinking:

(Tu pourras d ailleurs changer l auteur :grin:)

Salut,

Je pense pas pour le "hasDependency": false : Introduction Jeedom 4.2 : installation de dépendance – Jeedom – Le Blog

Je n’ai pas vu dans les posts de Loic qu’il fallait aussi indiquer qu’il y avait des dépendances, cette info doit justement être pour l’ancienne méthode d’installation des dépendances.

Pour l’auteur … oups, merci :rofl:

Hello,

Je viens de monter une installation from scratch depuis l’image Jeedom jeedom-debian-bullseye-amd64-4.3.17.iso

image

Lors de l’activation du package, les éléments manquant s’installent :

+ echo '*******************Begin of package installation******************'
*******************Begin of package installation******************
+ touch /tmp/jeedom_install_in_progress_blitzortung
+ echo 1
+ echo 2
++ cut -f 2-
++ awk '$1 <= 4'
++ find /usr/local/lib/python3.9/dist-packages/ -mindepth 1 -maxdepth 1 -type d -exec du -ks '{}' +
+ RESULTTODELETE=
++ sed 's, ,\ ,g'
++ echo ''
+ RESULTTODELETE2=
+ xargs rm -rf
+ echo ''
+ echo 3
+ sudo pip3 cache purge
ERROR: No matching packages
+ echo 4
+ sudo pip3 install --upgrade pip
Collecting pip
Downloading pip-23.2.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.3.4
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-23.2.1
+ echo 5
+ sudo pip3 install --force-reinstall --upgrade websockets
Collecting websockets
Downloading websockets-11.0.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.7/129.7 kB 892.9 kB/s eta 0:00:00
DEPRECATION: gpg 1.14.0-unknown has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of gpg or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: websockets
Successfully installed websockets-11.0.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ echo 6
+ php /var/www/html/core/class/../php/jeecli.php plugin dependancy_end blitzortung
+ rm /tmp/jeedom_install_in_progress_blitzortung
+ echo '*******************End of package installation******************'
*******************End of package installation******************

Dans les logs j’ai une autre erreur : Error: importing module from jeedom folder
Surement un truc foireux dans l’image et un problème de communication réseau de mon coté durant l’installation.

J’ai cherché un peu sur community, je suis tombé sur ce post : Error: importing module from jeedom folder au lancement du daemon

J’ai corrigé avec :

su -
apt-get install python3-pyudev
apt-get install python3-serial

Lors du lancement du démon : pas de soucis chez moi

[2023-08-06 09:04:06]INFO : Start demond
[2023-08-06 09:04:06]INFO : Log level : info
[2023-08-06 09:04:06]INFO : Socket port : 56023
[2023-08-06 09:04:06]INFO : Socket host : localhost
[2023-08-06 09:04:06]INFO : PID file : /tmp/jeedom/blitzortung/deamon.pid
[2023-08-06 09:04:06]INFO : Apikey : ****
[2023-08-06 09:04:06]INFO : Writing PID 5764 to /tmp/jeedom/blitzortung/deamon.pid
[2023-08-06 09:04:06]INFO : Init request module v2.25.1
[2023-08-06 09:04:06]INFO : Socket interface started
[2023-08-06 09:04:06]INFO : LoopNetServer Thread started
[2023-08-06 09:04:06]INFO : Listening on: [localhost:56023]

Du coup je suis encore plus paumé pour trouver le soucis. Me faudrait du support de personnes qui maitrise python et les méandres de python2 / python3 / pip / pip2 / pip3 / venv et j’en passe surement :frowning:

Tu peux deja faire un peu de menage dans le dossier/fichier jeedom pour ne garder que ce dont tu as besoin, et donc supprimer les import modules inutiles dans le fichier (et donc potentiellement dans l install)

1 « J'aime »

Pour ton problème avec serial, je le mentionne brièvement dans la doc; c’est le coup classique

La solution n’est pas de l’installer mais de supprimer l’import de ton code (et l’instanciation de l’objet correspondant)

J’avais bien vu ce point et supprimé l’import et la l’info dans les if

Il faut regarder ailleurs ?

EDIT :
Ah, vu il est dans le jeedom.py !
Pas contre le pyudev est bien nécessaire car importé dans le jeedom.py (je présume) et chez moi il ne s’était pas installé

Il n’y a pas grand chose en trop dans le répertoire, si ?
Je vais virer les imports que vsc remontent en non utilisés, merci.