Adafruit is open and shipping! Let's build back better, together!
0

PiOLED Not working at all
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: PiOLED Not working at all

by curious on Mon May 04, 2020 8:35 pm

Here are the installs I did:
Have done these installs:
sudo apt-get update
sudo apt-get upgrade
sudo pip3 install --setuptools
sudo pip3 install --upgrade setuptools
sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools
pip3 install RPI.GPIO
sudo pip3 install adafruit-circuitpython-ssd1306
sudo apt-get install python3-pil
sudo pip3 install requests

I tried using sudo for the pip3 install RPI.GPIO. and system says "Requirement already satisfied: RPI.GPIO in /usr/lib/python3/dist-packages.

So how do I fix my problem?
if I run stats.py with a sudo it stops at line 36 complaining it can't find board. If I run it without the sudo it stops at line 37 complaining "ImportError: No module named 'adafruit_ssd1306"
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Re: PiOLED Not working at all

by todpike on Tue May 05, 2020 10:19 am

If I remember correctly, the "board" package is part of the "adafruit_blinka" package. You should be able to get that installed by doing a "pip install Adafruit-Blinka". Give that a try.

todpike
 
Posts: 13
Joined: Mon Mar 02, 2020 3:48 pm

Re: PiOLED Not working at all

by curious on Tue May 05, 2020 10:44 am

Unfortunately, that didn't work either.

pi@pi-hole:~ $ pip install Adafruit-Blinka
Collecting Adafruit-Blinka
Could not find a version that satisfies the requirement Adafruit-Blinka (from versions: )
No matching distribution found for Adafruit-Blinka[/list]
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Re: PiOLED Not working at all

by todpike on Tue May 05, 2020 11:32 am

try "pip3 install adafruit-blinka" or "pip3 install Adafruit-Blinka". Not sure if case matters.

todpike
 
Posts: 13
Joined: Mon Mar 02, 2020 3:48 pm

Re: PiOLED Not working at all

by curious on Tue May 05, 2020 12:22 pm

Tried "pip3 install adafruit-blinka" and it successfully installed:
Successfully installed Adafruit-PlatformDetect-2.9.0 Adafruit-PureIO-1.1.5 RPi.GPIO-0.7.0 adafruit-blinka-4.8.0 aenum-2.2.3 pyftdi-0.51.0 pyserial-3.4 pyusb-1.0.2 rpi-ws281x-4.2.3 sysv-ipc-1.0.1

Tried running stats.py again - but no luck

pi@pi-hole:~ $ python3 stats.py
Traceback (most recent call last):
File "stats.py", line 37, in <module>
import adafruit_ssd1306
ImportError: No module named 'adafruit_ssd1306'

When I do a pip3 list, I see - among others:
Adafruit-Blinka (4.6.0)
Adafruit-PlatformDetect (2.8.0)
Adafruit-PureIO (1.1.5)
RPi.GPIO (0.7.0)
setuptools (46.1.3)

But no 'adafruit_ssd1306'

So I tried
pi@pi-hole:~ $ find -name '*ssd1306' // and that turned up nothing
pi@pi-hole:~ $ find -name 'adafruit*'
./.local/lib/python3.5/site-packages/adafruit_blinka
./.local/lib/python3.5/site-packages/adafruit_platformdetect
pi@pi-hole:~ $ find -name 'Adafruit*'
./.local/lib/python3.5/site-packages/Adafruit_PureIO-1.1.5.dist-info
./.local/lib/python3.5/site-packages/Adafruit_Blinka-4.6.0.dist-info
./.local/lib/python3.5/site-packages/Adafruit_PureIO
./.local/lib/python3.5/site-packages/Adafruit_Blinka-4.8.0.dist-info
./.local/lib/python3.5/site-packages/Adafruit_PlatformDetect-2.8.0.dist-info
./.local/lib/python3.5/site-packages/Adafruit_PlatformDetect-2.9.0.dist-info

Any idea where 'adafruit_ssd1306' might be hiding?
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Re: PiOLED Not working at all

by aphexx0407 on Tue May 05, 2020 12:29 pm

From the list of commands he stated from a previous comment I don't seem to see any command for

sudo apt-get install python3-pip
pip3 install adafruit-blinka

aphexx0407
 
Posts: 44
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED Not working at all

by aphexx0407 on Tue May 05, 2020 12:31 pm

After you run:
sudo apt-get install python3-pip

Run these next:
sudo pip3 install adafruit-circuitpython-ssd1306

aphexx0407
 
Posts: 44
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED Not working at all

by curious on Tue May 05, 2020 12:57 pm

That was interesting.
sudo apt-get install python3-pip // ran fine and gave me
python3-pip is already the newest version (9.0.1-2+rpt2).

pip3 install adafruit-blinka // also ran fine and gave me
Successfully installed Adafruit-PlatformDetect-2.9.0 Adafruit-PureIO-1.1.5 RPi.GPIO-0.7.0 adafruit-blinka-4.8.0 aenum-2.2.3 pyftdi-0.51.0 pyserial-3.4 pyusb-1.0.2 rpi-ws281x-4.2.3 sysv-ipc-1.0.1

Then I tried
sudo pip3 install adafruit-circuitpython-ssd1306 // and it failed
Downloading https://www.piwheels.org/simple/adafrui ... ne-any.whl
Collecting rpi-ws281x>=4.0.0 (from Adafruit-Blinka->adafruit-circuitpython-ssd1306)
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 391, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 387, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
response.begin()
File "/usr/lib/python3.5/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Re: PiOLED Not working at all

by aphexx0407 on Tue May 05, 2020 1:11 pm

Not sure as to why sudo pip3 install adafruit-circuitpython-ssd1306 command failed in downloading some files.

aphexx0407
 
Posts: 44
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED Not working at all

by aphexx0407 on Tue May 05, 2020 1:17 pm

Could you try to reboot your pihole and run
sudo pip3 install adafruit-circuitpython-ssd1306 again?

aphexx0407
 
Posts: 44
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED Not working at all

by curious on Tue May 05, 2020 2:22 pm

Well it didn't blow up this time but it still failed:

Bud--> ssh pi@10.0.1.30
pi@10.0.1.30's password:
Linux pi-hole 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May 5 14:11:21 2020 from 10.0.1.21
pi@pi-hole:~ $ sudo pip3 install adafruit-circuitpython-ssd1306
Collecting adafruit-circuitpython-ssd1306
Could not find a version that satisfies the requirement adafruit-circuitpython-ssd1306 (from versions: )
No matching distribution found for adafruit-circuitpython-ssd1306
pi@pi-hole:~ $

// ssd1306 seems to be missing somewhere. Any idea where?
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Re: PiOLED Not working at all

by todpike on Tue May 05, 2020 8:15 pm

that's really odd, because a pip3 search command does find the module:

$ pip3 search ssd1306
micropython-ssd1306 (0.2) - ssd1306 module for MicroPython
adafruit-circuitpython-ssd1306 (2.8.3) - CircuitPython library for SSD1306
OLED displays.
Adafruit-SSD1306 (1.6.2) - Python library to use SSD1306-based
128x64 or 128x32 pixel OLED displays
with a Raspberry Pi or Beaglebone
Black.

make sure you are connected to the network and check your spelling. it should be there.

todpike
 
Posts: 13
Joined: Mon Mar 02, 2020 3:48 pm

Re: PiOLED Not working at all

by todpike on Tue May 05, 2020 8:29 pm

Actually, I think I understand what is going on. You have to understand the difference between using "pip3 install" and "sudo pip3 install". When you use "pip3 install" without the sudo, it installs the python module in your personal python library. When you use "sudo pip3 install" it puts it in the system python library.

So, when you run your program using "sudo python3 <program name>", it will only search for the python libraries in the system areas, not in your personal area. Similarly, if you run your program without sudo ("python3 <program name>"), it only searches in your personal python area.

If you want to run your program using "sudo python3 <program name>", make sure you use "sudo pip3 install" on all the modules you need, or else your program won't find it. I think that the module you are trying to install is dependent on a module that you installed using the "other" way.

Give this a try and let us know.

todpike
 
Posts: 13
Joined: Mon Mar 02, 2020 3:48 pm

Re: PiOLED Not working at all

by todpike on Tue May 05, 2020 8:30 pm

Yes, I can see above that you ran "pip3 install adafruit-blinka". Run "sudo pip3 install adafruit-blinka" and then try the other module install. That should work.

todpike
 
Posts: 13
Joined: Mon Mar 02, 2020 3:48 pm

Re: PiOLED Not working at all

by curious on Wed May 06, 2020 9:09 am

You nailed it!! I ran
sudo pip3 install adafruit-blinka // followed by
sudo pip3 install adafruit-circuitpython-ssd1306

Then ran
sudo python3 stats.py

And it worked, finally!
Thanks for the assistance, I would have fumbled around and eventually given up on the whole idea.
curious
 
Posts: 10
Joined: Fri Jun 15, 2012 11:16 am

Please be positive and constructive with your questions and comments.