question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Library is not compatible with Python 3

See original GitHub issue

These errors occur:

Traceback (most recent call last):
  File "example.py", line 4, in <module>
    from ina219 import INA219
  File "/home/pi/pi_ina219/ina219.py", line 7, in <module>
    import Adafruit_GPIO.I2C as I2C
ImportError: No module named 'Adafruit_GPIO'

and:

  File "example.py", line 14
    print "Bus Voltage    : %.3f V" % ina.voltage()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
chrisb2commented, Mar 4, 2018

On a new installation of Raspbian I did:

  1. Enabled I2C in raspi-config
  2. Create a python test file containing just the two imports at the top of your file
  3. Ran my test file with python3 -> gave the same import error you get
  4. Installed Adafruit_GPIO with: pip3 install AdaFruit_GPIO
  5. Ran my test file again -> succeeded with no errors

So from this is does look like your system is to blame. So reinstalling Rasbian will work.

Chris

On Sun, Mar 4, 2018 at 12:06 PM, GawiQ notifications@github.com wrote:

LIS3DH_bus1.py.gz https://github.com/chrisb2/pi_ina219/files/1777999/LIS3DH_bus1.py.gz Manual installation didn’t work. Do you think system reinstallation would work? Here is the file

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/2#issuecomment-370187137, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8dV1HgP2JZYnP2SJ9bT4rTo1uAPXJSks5tayH8gaJpZM4L3C_7 .

1reaction
chrisb2commented, Feb 4, 2017

To install dependencies for Python 3 on Raspberry Pi, this need to be executed: sudo python3 -m pip install git+git://github.com/chrisb2/pi_ina219.git this fixes the import error above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

This is not compatible with python 3.9.2? · Issue #16 - GitHub
I downloaded the latest version since the version i had(3.7.3) did not work well when i ran poetry install. It threw this error...
Read more >
The Python Standard Library — Python 3.11.1 documentation
The library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible...
Read more >
Python 2 modules with python 3 - Stack Overflow
I tried to use pip-install to just load it into the 3.5 environment but that fails ( it has the code "(34*3600L)" in...
Read more >
Unable to install python 3.7 library - Super User
Please try installing directly from cmd with this command: pip install pandas. it will install the latest and compatible ...
Read more >
Cheat Sheet: Writing Python 2-3 compatible code
urllib module​​ urllib is the hardest module to use from Python 2/3 compatible code. You might want to switch to Requests (http://python-requests.org) instead....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found