Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

No module named micropython

330 views
Skip to first unread message

RobH

unread,
Dec 18, 2019, 7:01:48 AM12/18/19
to
I managed to install the micropython-ssd1327-1.0.0 library,according to
this:
https://www.raspberrypi.org/forums/viewtopic.php?t=191744
but after adding: import ssd1327
it returns

File "build/bdist.linux-armv6l/egg/ssd1327.py", line 5, in <module>
ImportError: No module named micropython

Have I missed something.

RobH

unread,
Dec 18, 2019, 8:54:27 AM12/18/19
to
Oops, a bit vague above.
I am trying to install the ssd1327 driver for a oled display.
Adafruit's library file won't install because

This library is not available on PyPI yet. Install documentation is
included as a standard element. Stay tuned for PyPI availability!

So then I found the same driver file for micropython, but I get the
above error when I import the said ssd1327 in a python script.

RobH

unread,
Dec 18, 2019, 3:57:36 PM12/18/19
to
On 18/12/2019 19:19, Dennis Lee Bieber wrote:
> On Wed, 18 Dec 2019 13:54:24 +0000, RobH <r...@despammer.com> declaimed the
> following:
>
>> On 18/12/2019 12:01, RobH wrote:
>>> I managed to install the micropython-ssd1327-1.0.0 library,according to
>>> this:
>>>  https://www.raspberrypi.org/forums/viewtopic.php?t=191744
>>> but after adding: import ssd1327
>>> it returns
>
> But did you also install /micropython/ itself?

Ok, my apologies, as I could NOT install the micropython-ssd1327-1.0.0
library because after I DID install micropython from here:

https://www.raspberrypi.org/forums/viewtopic.php?t=191744

I received the said error about no module called micropython
>
>>>
>>> File "build/bdist.linux-armv6l/egg/ssd1327.py", line 5, in <module>
>>> ImportError: No module named micropython
>>>
>>> Have I missed something.
> 50
>>
>> Oops, a bit vague above.
>> I am trying to install the ssd1327 driver for a oled display.
>> Adafruit's library file won't install because
>>
>> This library is not available on PyPI yet. Install documentation is
>> included as a standard element. Stay tuned for PyPI availability!
>>
>> So then I found the same driver file for micropython, but I get the
>> above error when I import the said ssd1327 in a python script.
>
>
> ... and if you did, are you invoking it? Micropython is not a module for
> regular Python, it is a separate limited language interpreter optimized for
> use on microcontrollers.

No I did not invoke as I didn't know that it had to be
>
> A search for "ssd1327 raspberry pi" leads to
> https://luma-oled.readthedocs.io/en/latest/intro.html
>
>
> FYI: from what I can tell, if the Adafruit library
> https://github.com/adafruit/Adafruit_CircuitPython_SSD1327/releases/tag/1.0.0
> can be used, you'll have to install the Adafruit blinka library to provide
> the CircuitPython interface API.
>
> As for the lack of PyPi availability...
>
>
> pi@rpi3bplus-1:~$ mkdir scratch
> pi@rpi3bplus-1:~$ cd scratch
> pi@rpi3bplus-1:~/scratch$ git init
> Initialized empty Git repository in /home/pi/scratch/.git/
> pi@rpi3bplus-1:~/scratch$ git clone
> https://github.com/adafruit/Adafruit_CircuitPython_SSD1327
> Cloning into 'Adafruit_CircuitPython_SSD1327'...
> remote: Enumerating objects: 36, done.
> remote: Counting objects: 100% (36/36), done.
> remote: Compressing objects: 100% (26/26), done.
> remote: Total 36 (delta 10), reused 30 (delta 8), pack-reused 0
> Unpacking objects: 100% (36/36), done.
> pi@rpi3bplus-1:~/scratch$ ls
> Adafruit_CircuitPython_SSD1327
> pi@rpi3bplus-1:~/scratch$ cd Adafruit_CircuitPython_SSD1327/
> pi@rpi3bplus-1:~/scratch/Adafruit_CircuitPython_SSD1327$ ls
> adafruit_ssd1327.py docs LICENSE requirements.txt
> CODE_OF_CONDUCT.md examples README.rst setup.py
> pi@rpi3bplus-1:~/scratch/Adafruit_CircuitPython_SSD1327$ sudo python3
> setup.py install
> running install
> running bdist_egg
> running egg_info
> creating adafruit_circuitpython_ssd1327.egg-info
> writing adafruit_circuitpython_ssd1327.egg-info/PKG-INFO
> <SNIP>
>
> Unfortunately, that relies upon /displayio/, which itself does not seem
> be available for Linux systems. It is part of
> pi@rpi3bplus-1:~/scratch$ git clone
> https://github.com/adafruit/circuitpython
> Cloning into 'circuitpython'...
>
> ... but setup.py fails on that download
>
> pi@rpi3bplus-1:~/scratch/circuitpython$ sudo pip3 install
> circuitpython-stubs
> Looking in indexes: https://pypi.org/simple,
> https://www.piwheels.org/simple
> Collecting circuitpython-stubs
> Downloading
> https://www.piwheels.org/simple/circuitpython-stubs/circuitpython_stubs-2019.7.7-py3-none-any.whl
> Installing collected packages: circuitpython-stubs
> Successfully installed circuitpython-stubs-2019.7.7
> pi@rpi3bplus-1:~/scratch/circuitpython$ sudo python3 setup.py install
> running install
> running bdist_egg
> running egg_info
> writing circuitpython_stubs.egg-info/PKG-INFO
> writing dependency_links to
> circuitpython_stubs.egg-info/dependency_links.txt
> writing top-level names to circuitpython_stubs.egg-info/top_level.txt
> error: package directory 'circuitpython-stubs' does not exist
> pi@rpi3bplus-1:~/scratch/circuitpython$
>
>

It looks like the Adafruit_CircuitPython_SS1327 library can't be
installed then, and the micropython-ssd1327-1.0.0 library can't be used
due to micropython not being invoked???

It now seems that the said oled display can't be used with a raspberry
pi, as it needs the ssd1327 library.

Thanks

RobH

unread,
Dec 19, 2019, 4:44:31 AM12/19/19
to
On 18/12/2019 21:35, Dennis Lee Bieber wrote:
> On Wed, 18 Dec 2019 20:57:34 +0000, RobH <r...@despammer.com> declaimed the
> following:
>
>
>>
>> Ok, my apologies, as I could NOT install the micropython-ssd1327-1.0.0
>> library because after I DID install micropython from here:
>>
>> https://www.raspberrypi.org/forums/viewtopic.php?t=191744
>>
>> I received the said error about no module called micropython
>
> Okay, if you built micropython, and the test (section 4) runs, I'd
> think the next move would be to follow step 5 to install the micropython
> package.
>
>> It looks like the Adafruit_CircuitPython_SS1327 library can't be
>> installed then, and the micropython-ssd1327-1.0.0 library can't be used
>> due to micropython not being invoked???
>>
> The Adafruit library requires /displayio/ but on Linux the
> adafruit_blinka interface library only provides
>
> """
> This repository contains a selection of packages mirroring the
> CircuitPython API on hosts running micropython. Working code exists to
> emulate the CircuitPython packages;
>
> board - breakout-specific pin identities
> microcontroller - chip-specific pin identities
> digitalio - digital input/output pins, using pin identities from
> board+microcontroller packages
> bitbangio - software-driven interfaces for I2C, SPI
> busio - hardware-driven interfaces for I2C, SPI, UART
> time * - substitute functions monkey-patched to time module
> """
> ... No displayio (nor many of the libraries shown
> https://circuitpython.readthedocs.io/en/4.x/shared-bindings/index.html )
>
> Micropython requires you to invoke it explicitly:
>
> <pathtobuild>/micropython <script>
>
>> It now seems that the said oled display can't be used with a raspberry
>> pi, as it needs the ssd1327 library.
>>
> I don't have the display to fully illustrate, but...
>
> https://luma-oled.readthedocs.io/en/latest/install.html and
> https://luma-oled.readthedocs.io/en/latest/python-usage.html
>
> ... gave me
>
> pi@rpi3bplus-1:~$ sudo apt install python3-dev libfreetype6-dev libjpeg-dev
> build-essential libopenjp2-7 libtiff5
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> build-essential is already the newest version (12.6).
> <SNIP>
> The following NEW packages will be installed:
> libjpeg-dev libjpeg62-turbo-dev
> 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
> Need to get 236 kB of archives.
> After this operation, 543 kB of additional disk space will be used.
> Do you want to continue? [Y/n]
> Get:1 http://raspbian-us.ngc292.space/raspbian buster/main armhf
> <SNIP>
> Setting up libjpeg-dev (1:1.5.2-2) ...
> pi@rpi3bplus-1:~$ pip3 install --upgrade luma.oled
> Collecting luma.oled
> Downloading
> https://files.pythonhosted.org/packages/fd/70/b03e0cf2040113db644a220d546a9c42907c4884a898722312c83b0f5603/luma.oled-3.3.0-py2.py3-none-any.whl
> Collecting luma.core>=1.12.0 (from luma.oled)
> Downloading
> https://files.pythonhosted.org/packages/a7/36/f10ac3202221c479bae89e3226e57dcbf31c08f4d9e5743f32e193147a22/luma.core-1.12.0-py2.py3-none-any.whl
> (51kB)
> 100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 61kB 1.0MB/s
> Requirement already satisfied, skipping upgrade: spidev; platform_system ==
> "Linux" in /usr/local/lib/python3.7/dist-packages (from
> luma.core>=1.12.0->luma.oled) (3.4)
> <SNIP>
> Installing collected packages: luma.core, luma.oled
> Successfully installed luma.core-1.12.0 luma.oled-3.3.0
> pi@rpi3bplus-1:~$ python3
> Python 3.7.3 (default, Apr 3 2019, 05:39:12)
> [GCC 8.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from luma.core.interface.serial import i2c, spi
>>>> from luma.core.render import canvas
>>>> from luma.oled.device import ssd1327
>>>>
>
> Looks to me like the display is feasible (the usage page didn't list
> the 1327, but imported 1306, 1309, 1325, 13331, and sh1106 -- I took a
> chance specifying 1327, and it took without error) {I've now uninstalled
> since, as stated, I don't have the display, so why clutter SD card}
>
> Obviously, you'll need to follow the luma.oled API to use the display.
>
>
>
>

Thanks for that.
I already had some of the files installed from a previous attempt.
In the luma.examples/examples folder, I edited the clock.py script to
include:

from luma.core.interface.serial import i2c, spi
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1309, ssd1325, ssd1331, sh1106

but edited the last line to just
from luma.oled.device import ssd1327.

When I ran the script :
pi@raspberrypi:~/luma.examples/examples $ python clock.py
Version: luma.oled 3.3.0 (luma.core 1.12.0)
Display: ssd1306
Interface: i2c
Dimensions: 128 x 64

and there was no errors and nothing on the display.
0 new messages