Plugin BLEA erreur "No module named 'bluepy'"

Tags: #<Tag:0x00007fcbbb7cd128>

Bonjour,
J’ai le plugin BLEA sur Jeedom 4.0.62 et branché la clé UD100-G03.
L’installation des dépendances n’a pas signalé d’erreurs :

 ********************************************************
 *			 Installation des dépendances			 *
 ********************************************************
 Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
 Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease
 Ign:3 http://ftp.fr.debian.org/debian stretch InRelease
 Hit:4 http://phoscon.de/apt/deconz stretch InRelease
 Hit:5 http://ftp.fr.debian.org/debian stretch-updates InRelease
 Hit:6 https://dl.yarnpkg.com/debian stable InRelease
 Hit:7 http://ftp.fr.debian.org/debian stretch Release
 Hit:8 https://deb.nodesource.com/node_12.x stretch InRelease
 Hit:9 https://repository.salamek.cz/deb/pub all InRelease
 Reading package lists...
 Reading package lists...
 Building dependency tree...
 Reading state information...
 libatlas-base-dev is already the newest version (3.10.3-1+b1).
 build-essential is already the newest version (12.3).
 libffi-dev is already the newest version (3.2.1-6).
 python3-serial is already the newest version (3.2.1-1).
 python3-setuptools is already the newest version (33.1.1-1).
 python3-dev is already the newest version (3.5.3-1).
 python3-pyudev is already the newest version (0.21.0-1).
 python3-requests is already the newest version (2.12.4-1).
 rfkill is already the newest version (0.5-1+b1).
 libtiff5 is already the newest version (4.0.8-2+deb9u5).
 bluetooth is already the newest version (5.43-2+deb9u3).
 libbluetooth-dev is already the newest version (5.43-2+deb9u3).
 libopenjp2-7 is already the newest version (2.1.2-1.1+deb9u5).
 libssl-dev is already the newest version (1.1.0l-1~deb9u2).
 The following packages were automatically installed and are no longer required:
 linux-image-4.9.0-12-amd64 linux-image-4.9.0-8-amd64
 Use 'sudo apt autoremove' to remove them.
 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
 Reading package lists...
 Building dependency tree...
 Reading state information...
 The following packages were automatically installed and are no longer required:
 linux-image-4.9.0-12-amd64 linux-image-4.9.0-8-amd64
 Use 'sudo apt autoremove' to remove them.
 debconf: unable to initialize frontend: Dialog
 debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
 debconf: falling back to frontend: Readline
 debconf: unable to initialize frontend: Readline
 debconf: (This frontend requires a controlling tty.)
 debconf: falling back to frontend: Teletype
 dpkg-preconfigure: unable to re-open stdin:
 0 upgraded, 0 newly installed, 3 reinstalled, 0 to remove and 1 not upgraded.
 Need to get 0 B/1118 kB of archives.
 After this operation, 0 B of additional disk space will be used.
 (Reading database ... 
 (Reading database ... 5%
 (Reading database ... 10%
 (Reading database ... 15%
 (Reading database ... 20%
 (Reading database ... 25%
 (Reading database ... 30%
 (Reading database ... 35%
 (Reading database ... 40%
 (Reading database ... 45%
 (Reading database ... 50%
 (Reading database ... 55%
 (Reading database ... 60%
 (Reading database ... 65%
 (Reading database ... 70%
 (Reading database ... 75%
 (Reading database ... 80%
 (Reading database ... 85%
 (Reading database ... 90%
 (Reading database ... 95%
 (Reading database ... 100%
 (Reading database ... 341932 files and directories currently installed.)
 Preparing to unpack .../python3_3.5.3-1_amd64.deb ...
 running python pre-rtupdate hooks for python3.5...
 Unpacking python3 (3.5.3-1) over (3.5.3-1) ...
 Preparing to unpack .../bluez_5.43-2+deb9u3_amd64.deb ...
 Unpacking bluez (5.43-2+deb9u3) over (5.43-2+deb9u3) ...
 Preparing to unpack .../python3-pip_9.0.1-2+deb9u2_all.deb ...
 Unpacking python3-pip (9.0.1-2+deb9u2) over (9.0.1-2+deb9u2) ...
 Setting up python3 (3.5.3-1) ...
 running python rtupdate hooks for python3.5...
 running python post-rtupdate hooks for python3.5...
 Processing triggers for systemd (232-25+deb9u12) ...
 Setting up python3-pip (9.0.1-2+deb9u2) ...
 Processing triggers for man-db (2.7.6.1-2) ...
 Processing triggers for dbus (1.10.32-0+deb9u1) ...
 Setting up bluez (5.43-2+deb9u3) ...
 Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (51.1.2)
 Reading package lists...
 Building dependency tree...
 Reading state information...
 git is already the newest version (1:2.11.0-3+deb9u7).
 libglib2.0-dev is already the newest version (2.50.3-2+deb9u2).
 The following packages were automatically installed and are no longer required:
 linux-image-4.9.0-12-amd64 linux-image-4.9.0-8-amd64
 Use 'sudo apt autoremove' to remove them.
 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
 Requirement already satisfied: pyudev in /usr/local/lib/python3.6/site-packages (0.22.0)
 Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from pyudev) (1.15.0)
 Requirement already satisfied: pyserial in /usr/local/lib/python3.6/site-packages (3.5)
 Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (2.25.1)
 Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests) (1.26.2)
 Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests) (4.0.0)
 Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests) (2020.12.5)
 Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests) (2.10)
 Requirement already satisfied: pybluez in /usr/local/lib/python3.6/site-packages (0.23)
 Requirement already satisfied: pillow in /usr/local/lib/python3.6/site-packages (8.1.0)
 Requirement already satisfied: numpy in /usr/local/lib/python3.6/site-packages (1.19.5)
 Requirement already satisfied: bluepy in /usr/local/lib/python3.6/site-packages (1.1.4)
 Cloning into 'bluepy'...
 running build
 running build_py
 creating build
 creating build/lib
 creating build/lib/bluepy
 copying bluepy/get_services.py -> build/lib/bluepy
 copying bluepy/sensortag.py -> build/lib/bluepy
 copying bluepy/btle.py -> build/lib/bluepy
 copying bluepy/blescan.py -> build/lib/bluepy
 copying bluepy/__init__.py -> build/lib/bluepy
 copying bluepy/scanner.py -> build/lib/bluepy
 copying bluepy/thingy52.py -> build/lib/bluepy
 copying bluepy/scan_fuzz.py -> build/lib/bluepy
 copying bluepy/uuids.json -> build/lib/bluepy
 copying bluepy/bluez-src.tgz -> build/lib/bluepy
 copying bluepy/bluepy-helper.c -> build/lib/bluepy
 copying bluepy/Makefile -> build/lib/bluepy
 running install
 Working dir is /tmp/bluepy
 execute make -C ./bluepy clean
 execute make -C bluepy -j1
 running build
 running build_py
 copying bluepy/bluepy-helper -> build/lib/bluepy
 running install_lib
 copying build/lib/bluepy/get_services.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/bluepy-helper -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/sensortag.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/btle.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/blescan.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/bluepy-helper.c -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/__init__.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/scanner.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/bluez-src.tgz -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/uuids.json -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/thingy52.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/scan_fuzz.py -> /usr/local/lib/python3.6/site-packages/bluepy
 copying build/lib/bluepy/Makefile -> /usr/local/lib/python3.6/site-packages/bluepy
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/get_services.py to get_services.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/sensortag.py to sensortag.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/btle.py to btle.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/blescan.py to blescan.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/__init__.py to __init__.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/scanner.py to scanner.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/thingy52.py to thingy52.cpython-36.pyc
 byte-compiling /usr/local/lib/python3.6/site-packages/bluepy/scan_fuzz.py to scan_fuzz.cpython-36.pyc
 running install_egg_info
 running egg_info
 creating bluepy.egg-info
 writing bluepy.egg-info/PKG-INFO
 writing dependency_links to bluepy.egg-info/dependency_links.txt
 writing entry points to bluepy.egg-info/entry_points.txt
 writing top-level names to bluepy.egg-info/top_level.txt
 writing manifest file 'bluepy.egg-info/SOURCES.txt'
 reading manifest file 'bluepy.egg-info/SOURCES.txt'
 writing manifest file 'bluepy.egg-info/SOURCES.txt'
 removing '/usr/local/lib/python3.6/site-packages/bluepy-1.1.4-py3.6.egg-info' (and everything under it)
 Copying bluepy.egg-info to /usr/local/lib/python3.6/site-packages/bluepy-1.1.4-py3.6.egg-info
 running install_scripts
 Installing blescan script to /usr/local/bin
 Installing sensortag script to /usr/local/bin
 Installing thingy52 script to /usr/local/bin
 Requirement already satisfied: cryptography in /usr/local/lib/python3.6/site-packages (3.3.1)
 Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.6/site-packages (from cryptography) (1.14.4)
 Requirement already satisfied: six>=1.4.1 in /usr/local/lib/python3.6/site-packages (from cryptography) (1.15.0)
 Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.12->cryptography) (2.20)
 Requirement already satisfied: pycrypto in /usr/local/lib/python3.6/site-packages (2.6.1)
 ********************************************************
 *			 Installation terminée					*
 ********************************************************

EN revanche, je reconstate que le démon refuse de démarrer. Je constate l’erreur suivante dans la log :

Traceback (most recent call last):
File « /var/www/html/plugins/blea/resources/blead/blead.py », line 26, in
from bluepy.btle import Scanner, DefaultDelegate
ImportError: No module named ‹ bluepy ›
Traceback (most recent call last):
File « /var/www/html/plugins/blea/resources/blead/blead.py », line 26, in
from bluepy.btle import Scanner, DefaultDelegate
ImportError: No module named ‹ bluepy ›

J’ai procédé à une réinstallation manuelle de BLEA ainsi que de bluepy selon les préco trouvées ici https://github.com/sarakha63/bluepy mais rien n’y fait. Je ne sais pas où est l’erreur. Quelqu’un a-t-il une petite idée de ce qui se passe car je me trouve personnellement complètement dans le brouillard…

Pour ceux que cela intéresse, je me suis finalement décidée à modifier le code python de démon blead.py en y ajoutant au début les consignes uivantes :

import sys
sys.path.append("/usr/local/lib/bluepy")

qui permettent d’indiquer à l’interpréteur Python d’aller chercher ses modules dans un dossier supplémentaire qui est bien sûr celui du module manquant.

Il faudra faire attention à la prochaine mise à jour du plugin car cette modification sautera.

Le fil est maintenant clos pour ce problème.

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