ModuleNotFoundError: No module named 'bluetooth'

Bonjour à tous,
Comme expliqué dans un autre fil j’ai fait une nouvelle VM sur mon serveur Proxmox de façon à pouvoir repartir pour mon Jeedom de prod en Debian 10 et ainsi pouvoir enfin passer en Jeedom 4.2 (exactement 4.2.21 stable).
En fait je n’ai pratiquement pas eu de problème, seul le plugin Odace SFSP me fait des misères.
Tout d’abord malgré le USB passthrough la clé bluetooth Sena UD 100 n’apparaissait pas dans la page de configuration du plugin. Mais après extinction totale, débranchement de la clé redémarrage ce problème semble corrigé.


Mais le démon est toujours NOK
le log beagle

[2022-09-03 17:18:04][DEBUG] : Lancement démon beagle : sudo /usr/bin/python3 /var/www/html/plugins/beagle/resources/beagled/beagled.py --device hci0 --loglevel debug --socketport 55556 --sockethost 127.0.0.1 --callback http://127.0.0.1:80/plugins/beagle/core/php/jeeBeagle.php --apikey 6BIZlaD8wlaxHTO9KqcEExT4C6WvlBBW --cycle 0.1 --jeedomkey 9f49672b12b03139622715a7
Traceback (most recent call last):
  File "/var/www/html/plugins/beagle/resources/beagled/beagled.py", line 28, in <module>
    import blescan
  File "/var/www/html/plugins/beagle/resources/beagled/blescan.py", line 21, in <module>
    import bluetooth._bluetooth as bluez
ModuleNotFoundError: No module named 'bluetooth'
[2022-09-03 17:18:09][ERROR] : Impossible de lancer le démon beagle, vérifiez le port

Et le log beagle_update

********************************************************
*             Installation des dépendances             *
********************************************************
Hit:1 http://ftp.fr.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Hit:3 http://ftp.fr.debian.org/debian buster-updates InRelease
Hit:4 https://deb.nodesource.com/node_16.x buster InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (18.1-5).
python3-setuptools is already the newest version (40.8.0-1).
rfkill is already the newest version (2.33.1-0.1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
bluetooth is already the newest version (5.50-1.2~deb10u2).
libbluetooth-dev is already the newest version (5.50-1.2~deb10u2).
build-essential is already the newest version (12.6).
libffi-dev is already the newest version (3.2.1-9).
python3-pip is already the newest version (18.1-5).
python3-dev is already the newest version (3.7.3-1).
libssl-dev is already the newest version (1.1.1n-0+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (2.28.1)
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.7/dist-packages (from requests) (2.0.12)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests) (1.26.12)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests) (2022.6.15)
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
Requirement already satisfied: pyserial in /usr/local/lib/python3.7/dist-packages (3.5)
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
Requirement already satisfied: pyudev in /usr/local/lib/python3.7/dist-packages (0.24.0)
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
Requirement already satisfied: wheel in /usr/local/lib/python3.7/dist-packages (0.37.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
Requirement already satisfied: cryptography==2.6.1 in /usr/local/lib/python3.7/dist-packages (2.6.1)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from cryptography==2.6.1) (1.16.0)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3/dist-packages (from cryptography==2.6.1) (0.24.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python3.7/dist-packages (from cryptography==2.6.1) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi!=1.11.3,>=1.8->cryptography==2.6.1) (2.21)
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
Collecting pybluez
  Using cached PyBluez-0.23.tar.gz (97 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in PyBluez setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
********************************************************
*             Installation terminée                    *
********************************************************

J’ai bien sûr relancé plusieurs fois les dépendances sans que çà change quoi que ce soit
le résultat de lsusb dans proxmox

root@pve:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 001 Device 004: ID 8087:0aaa Intel Corp. 
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@pve:~#

Et dans la VM
lsusb_vm

Voila n’hésitez pas à me demander des infos supplémentaires ou à me suggérer des pistes
Merci de votre aide.

Salut,

Si « bluetooth » manque je dirais que

sudo pip3 install bluetooth 

devrait aider ?

Merci @Mips je suis idiot de ne pas y avoir pensé !
Mais voici le retour

ERROR: Could not find a version that satisfies the requirement bluetooth (from version: none)
ERROR: No matching distribution found for bluetooth

Je précise que j’ai fait l’install en créant la VM puis en utilisant l’image jeedom-debian-buster-amd64 indiquée par Loic pour gagner du temps, je ne sais pas si c’est lié à ce problème ou pas.

J’étais sur mobile et je n’avais pas bien regardé le log.
Dans le log on voit qu’en fait il est installé :thinking:

par contre il y a eu des erreurs à l’install de pybluez; ca ne doit pas aider:

c’est dû au fait que use_2to3 n’est plus inclus dans setuptools; (trouvé sur le net: python - Error while downloading the requirements using pip install (setup command: use_2to3 is invalid.) - Stack Overflow)
il propose de downgrader setuptools en version 58 (mais apparemment tu as la version 40; p-e pcq installé via apt?)
tu peux essayer ceci et si il a pu installer une autre version de setuptools alors relancer les dépendances et voir le nouveau log

sudo pip3 install setuptools==58

par contre cela risque de poser problème pour une autre installation de dépendances (ou pour ce plugin si tu relances les dépendances alors que setuptools est remodifié…)

Un grand merci @Mips


Et les dépendances montrant que pybluez s’installe bien cette fois

********************************************************
*             Installation des dépendances             *
********************************************************
Get:1 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Hit:2 http://ftp.fr.debian.org/debian buster InRelease
Get:3 http://ftp.fr.debian.org/debian buster-updates InRelease [56.6 kB]
Hit:4 https://deb.nodesource.com/node_16.x buster InRelease
Get:5 http://security.debian.org/debian-security buster/updates/main Sources [255 kB]
Get:6 http://security.debian.org/debian-security buster/updates/main amd64 Packages [348 kB]
Fetched 695 kB in 0s (1960 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
python3-pip is already the newest version (18.1-5).
python3-setuptools is already the newest version (40.8.0-1).
rfkill is already the newest version (2.33.1-0.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
bluetooth is already the newest version (5.50-1.2~deb10u2).
libbluetooth-dev is already the newest version (5.50-1.2~deb10u2).
build-essential is already the newest version (12.6).
libffi-dev is already the newest version (3.2.1-9).
python3-pip is already the newest version (18.1-5).
python3-dev is already the newest version (3.7.3-1).
libssl-dev is already the newest version (1.1.1n-0+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (2.28.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests) (1.26.12)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests) (2022.6.15)
Requirement already satisfied: charset-normalizer<3,>=2 in /usr/local/lib/python3.7/dist-packages (from requests) (2.0.12)
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
Requirement already satisfied: pyserial in /usr/local/lib/python3.7/dist-packages (3.5)
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
Requirement already satisfied: pyudev in /usr/local/lib/python3.7/dist-packages (0.24.0)
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
Requirement already satisfied: wheel in /usr/local/lib/python3.7/dist-packages (0.37.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
Requirement already satisfied: cryptography==2.6.1 in /usr/local/lib/python3.7/dist-packages (2.6.1)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3/dist-packages (from cryptography==2.6.1) (0.24.0)
Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from cryptography==2.6.1) (1.16.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python3.7/dist-packages (from cryptography==2.6.1) (1.15.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi!=1.11.3,>=1.8->cryptography==2.6.1) (2.21)
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
Collecting pybluez
  Using cached PyBluez-0.23.tar.gz (97 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: pybluez
  Building wheel for pybluez (setup.py): started
  Building wheel for pybluez (setup.py): finished with status 'done'
  Created wheel for pybluez: filename=PyBluez-0.23-cp37-cp37m-linux_x86_64.whl size=138659 sha256=84b0adc5595949166fc8328e2f934c42062fc4a867aab45b1e55936b974cf78e
  Stored in directory: /root/.cache/pip/wheels/86/41/70/cd8dee07032c22301356f5fc7788d29e5dac164b3e0ac8879a
Successfully built pybluez
Installing collected packages: pybluez
Successfully installed pybluez-0.23
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
********************************************************
*             Installation terminée                    *
********************************************************

Et boutons et boites de centre marchent bien (en fait dans les pièces où il y a à la fois boutons et boites de centre Odace SFSP, çà marchait même sans le plugin puisqu’ils sont aussi associés en direct mais dans les pièces où les boutons Odace SFSP commandent des ampoules Philips Hue et pour les scénarios c’était KO et maintenant çà fonctionne)
Encore merci je ne m’en serait pas sorti sans ton aide.
Peut-être faudrait-il signaler le problème pour modifier le script d’installation des dépendances, comme c’est un plugin officiel mais comme les beta sont autorisés sont mon compte market je ne peux pas ouvrir un ticket.

1 « J'aime »

En principe l’équipe a vu le post :wink:

Mais downgrade setup tools n’est pas une solution, d’autres plug-in pourraient avoir besoin d’une version plus récente, garde ça en tête si tu as un autre soucis du genre.

Au moins tu es débloqué.

Oui et je suis bien content car je pars en vacances samedi et j’angoissais un peu que la personne qui va venir s’occuper des chats soit perdue avec ces boutons non fonctionnels.
Visiblement le problème est répertorié chez pibluez :

Donc une solution plus perenne dépasse le cadre de jeedom

Et comme dit dans le lien ci-dessus

The 2to3 was fixed in master, but it has not been released to pypi.

Il y a bien un fix (très simple) dans la branche master
https://github.com/pybluez/pybluez/commit/37d78880179b2a83e7052e0c2b9393499dd3b857

Comme pybluez ne semble pas prêt à publier le fix sur pypi peut-être une solution serait d’utiliser pybluez2 qui lui semble activement maintenu ?

Et peut-être d’autres plugins jeedom qui utilisent pybluez présentent le même problème ? Je ne sais pas qui dans la team a écrit le plugin beagle, si je me souviens bien c’était une demande de Schneider à Jeedom. @Loic sais peut-être

Bonjour
Je sais pas du tout désolé… Le mieux est d’ouvrir un ticket au support la.

Merci Loic mais avec les beta autorisés je pense que je ne peux pas

Je peux pas aider là malheureusement, par contre c’est que si tu as des betas d’installé, si c’est juste autorisé pas de soucis

Bon j’ai pu faire un ticket rapport de bug. et j’ai bien reçu un accusé de réception. Pourtant j’ai bien des betas d’installées (mes plugins).

Si je trouve un peu de temps je ferai une autre VM en changeant

sudo pip3 install pybluez

dans le install_apt.sh du plugin beagle pour installer pybluez2 à la place et voir si çà marche

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.