This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error processing ADS1015: has no attribute 'P0'
#1
So after getting the i2c service running following the advice in this thread:
I2C service not running ...Work Around

I now have the below error with my ads1015:

Checking I2C sensors... | service running | I2C enabled | Access to Signal K server validated
↳Error processing ADS1015: module 'adafruit_ads1x15.ads1015' has no attribute 'P0'

Spent a little time with the AI help bots, but honestly they were taking me down a rabbit hole that I just wasn't comfortable following fearing I would break my 99% working setup.

Does anybody "human" have any thoughts on how to resolve the no attribute 'P0' error? 

Hope it's an easy fix :-(

Thanks
Mitch -  (53 year old sailor not computor programmer  Confused)
Reply
#2
(2026-01-11, 06:42 PM)Mitch C Wrote: Does anybody "human" have any thoughts on how to resolve the no attribute 'P0' error? 

Only what a good Ai will find - Perplexity says there was a fairly recent library change which might have broken it. 

Try  
pip list | grep ads1x15
in a terminal to see what version your library is, might be a smoking gun to look at first


Quote: Discussion and implementation in late 2024 (around the v3.0 release cycle) aimed to further clean up these imports by moving constants like P0 into an enum-like Pin class
Reply
#3
(2026-01-11, 07:14 PM)PaddyB Wrote:
(2026-01-11, 06:42 PM)Mitch C Wrote: Does anybody "human" have any thoughts on how to resolve the no attribute 'P0' error? 

Only what a good Ai will find - Perplexity says there was a fairly recent library change which might have broken it. 

Try  
pip list | grep ads1x15
in a terminal to see what version your library is, might be a smoking gun to look at first


Quote: Discussion and implementation in late 2024 (around the v3.0 release cycle) aimed to further clean up these imports by moving constants like P0 into an enum-like Pin class

Result is:
adafruit-circuitpython-ads1x15          3.0.2

After antoher session with Perplexity, I still have the error.
The steps below that AI recommended: I tried option 1 as I don;t want to break my 99% running system.
Any other thioughts on how tio define the P0 within Openplotter?

That E: Unable to locate package ... just means OpenPlotter’s underlying Debian/Raspberry Pi OS does not ship a python3-adafruit-circuitpython-ads1x15 apt package, so you need to use pip instead of apt for this library.

Because your Python is “externally managed”, there are two realistic options on an appliance image like OpenPlotter.
Option 1 – Install via pip for your user (safer)

Install the library into your user’s site-packages and avoid touching system packages:

bash
pip3 install --user adafruit-circuitpython-ads1x15

If you still hit the “externally managed” error, add the override:

bash
pip3 install --user adafruit-circuitpython-ads1x15 --break-system-packages

This follows Adafruit’s recommendation to install from PyPI on Raspberry Pi, while using the PEP 668 override.

After this, restart Signal K so its Python helper sees the new package:

bash
sudo systemctl restart signalk

Option 2 – System-wide via pip (more intrusive)

If OpenPlotter’s Signal K tools run strictly under the system Python and do not see user-site packages, you may need to go system-wide:

bash
sudo pip3 install adafruit-circuitpython-ads1x15 --break-system-packages

This is exactly the pattern documented for Raspberry Pi plus the --break-system-packages flag to bypass the externally managed guard.

Again, restart Signal K afterwards.
After installing

Once the library is present, your remaining ADS1015 issue is the missing P0 constant. You can:
    Update the plugin/code to use integer channels (0–3) instead of P0–P3, or
    Import/define P0–P3 yourself as described earlier.
Reply
#4
(2026-01-17, 07:10 PM)Mitch C Wrote: Result is:
adafruit-circuitpython-ads1x15          3.0.2


Any other thioughts on how tio define the P0 within Openplotter?

Sorry, no, sounds like might be a bug. Quick search says the adafruit library is the latest version.  Confused
I haven't gone that route before in OP for ADS1x15 so not sure how much assistance I can be. Downloaded the code from github into vscode & let copilot have a good look around then gave it your error, came up with..

Quote:The issue was that the code was trying to access pin constants (P0, P1, etc.) from the ADS11 and ADS10 modules, but these constants are actually defined in the parent adafruit_ads1x15.ads1x15 module.

I've fixed this by:

Adding the import: from adafruit_ads1x15.ads1x15 import P0, P1, P2, P3
Changing all references from ADS11.P0 to P0, ADS10.P0 to P0, etc.
This should resolve the AttributeError. You'll need to restart the OpenPlotter I2C service for the changes to take effect. You can do this by:

Stopping the service: sudo systemctl stop openplotter-i2c-read.service
Starting it again: sudo systemctl start openplotter-i2c-read.service
Or through the OpenPlotter I2C GUI by toggling the service off and on again.

If you want to give it a go I could send the updated i2c_read file to try, can't see what damage it could other than more error messages & frustration  Rolleyes
The grownups are usually not far off if their not too busy so someone who knows for sure might come along
Reply
#5
[quote pid="35717" dateline="1768680269"]

If you want to give it a go I could send the updated i2c_read file to try, can't see what damage it could other than more error messages & frustration  Rolleyes
The grownups are usually not far off if their not too busy so someone who knows for sure might come along

[/quote]

Sorry for the slow reply - been at the Dussledorf boat show for a few days - highly recommended if you've never been!!

I'm happy to try the updated i2c file - as you say it could work or it could trigger more errors. 
If its the later I can revert back to the originasl until the grown ups come and help :-)

Thanks for the support,
Mitch
Reply
#6
(2026-01-24, 07:36 PM)Mitch C Wrote: [quote pid="35717" dateline="1768680269"]

If you want to give it a go I could send the updated i2c_read file to try, can't see what damage it could other than more error messages & frustration  Rolleyes
The grownups are usually not far off if their not too busy so someone who knows for sure might come along

Sorry for the slow reply - been at the Dussledorf boat show for a few days - highly recommended if you've never been!!

I'm happy to try the updated i2c file - as you say it could work or it could trigger more errors. 
If its the later I can revert back to the originasl until the grown ups come and help :-)

Thanks for the support,
Mitch
[/quote]

I'am interested by your update file to test it, where can I find it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)