Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name btle #7

Open
gholit opened this issue Apr 9, 2022 · 4 comments
Open

ImportError: cannot import name btle #7

gholit opened this issue Apr 9, 2022 · 4 comments

Comments

@gholit
Copy link

gholit commented Apr 9, 2022

Hello,

I bought the RadonEye RD200 (GTIN: 4260514360076 ) and am trying to extract the log.
However I get this error:

pi@iobroker-pi:~ $ ./radon_reader.py
Traceback (most recent call last):
  File "./radon_reader.py", line 14, in <module>
    from bluepy import btle
ImportError: cannot import name btle

Anyone know how to solve it?

Raspberry Pi 3 Modell B
Linux iobroker-pi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
bluepy 1.3.0

@dicer
Copy link

dicer commented Apr 9, 2022

Are you sure you have bluepy installed? btle is one of the components of it. See https://github.com/IanHarvey/bluepy for instructions

@gholit
Copy link
Author

gholit commented Apr 9, 2022

Thank you for your comment.

I already had bluepy installed with this guide.
For testing I removed bluepy and libglib2.0-dev to reinstall.

pi@iobroker-pi:~ $ sudo apt-get install python3-pip libglib2.0-dev
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
python3-pip ist schon die neueste Version (18.1-5+rpt1).
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:
  fontconfig gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-harfbuzz-0.0 gir1.2-pango-1.0 gir1.2-rsvg-2.0 icu-devtools libcairo-gobject2 libcairo-script-interpreter2 libcairo2 libcroco3 libdatrie1 libfontconfig1-dev libfribidi-dev libgraphite2-3 libgraphite2-dev libharfbuzz-gobject0 libharfbuzz-icu0 libharfbuzz0b
  libice-dev libicu-dev liblzo2-2 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpangoxft-1.0-0 libpixman-1-0 libpixman-1-dev libpthread-stubs0-dev librsvg2-2 librsvg2-common libsm-dev libthai-data libthai0 libx11-dev libxau-dev libxcb-render0 libxcb-render0-dev libxcb-shm0 libxcb-shm0-dev libxcb1-dev
  libxdmcp-dev libxext-dev libxft-dev libxrender-dev pango1.0-tools x11proto-core-dev x11proto-dev x11proto-xext-dev xorg-sgml-doctools xtrans-dev
Verwenden Sie »sudo apt autoremove«, um sie zu entfernen.
Vorgeschlagene Pakete:
  libglib2.0-doc
Die folgenden NEUEN Pakete werden installiert:
  libglib2.0-dev
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 1.372 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 7.432 kB Plattenplatz zusätzlich benutzt.
Möchten Sie fortfahren? [J/n] j
Holen:1 http://mirror.chaoticum.net/rpi/raspbian buster/main armhf libglib2.0-dev armhf 2.58.3-2+deb10u2 [1.372 kB]
Es wurden 1.372 kB in 1 s geholt (2.650 kB/s).
Vormals nicht ausgewähltes Paket libglib2.0-dev:armhf wird gewählt.
(Lese Datenbank ... 61202 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../libglib2.0-dev_2.58.3-2+deb10u2_armhf.deb ...
Entpacken von libglib2.0-dev:armhf (2.58.3-2+deb10u2) ...
libglib2.0-dev:armhf (2.58.3-2+deb10u2) wird eingerichtet ...
Trigger für libglib2.0-0:armhf (2.58.3-2+deb10u2) werden verarbeitet ...
Keine Schema-Dateien gefunden: Nichts wird getan.

Is the last line (No schema files found: Nothing is done.) an error?

pi@iobroker-pi:~ $ sudo pip3 install bluepy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting bluepy
  Using cached https://www.piwheels.org/simple/bluepy/bluepy-1.3.0-cp37-cp37m-linux_armv7l.whl
Installing collected packages: bluepy
Successfully installed bluepy-1.3.0

@dicer
Copy link

dicer commented Apr 9, 2022

I think you installed using pip3 but you start with python2, so bluepy is not found. Try the patch in issue #6 and start with python3 radon_reader.py

@gholit
Copy link
Author

gholit commented Apr 10, 2022

I had already patched it before and also tried to start it with python2 and python3.

The only difference to the python2 call:
ImportError: cannot import name 'btle' from 'bluepy' (/home/pi/bluepy/init.py)

/home/pi/bluepy/init.py is an empty file.

Python3 was already installed because of the iobroker. I installed Python2 for debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants