I have set up my Raspberry Pi Pico and successfully run several MicroPython examples, however, I am now trying to run the 1306 OLED example from Appendix A of the Raspberry Pi Pico Python SDK.

It fails on the second line of code:

from ssd1306 import SSD1306_I2C

When I run the above line of code either from the REPL or by saving the code to the Pico and running it via Thonny. I get an "ImportError: no module named ssd1306" Where do I find this module and how do I install it?

3 Answers 3


The module is in the Raspberry Pi's MicroPython repository.

To include it in your project:

  1. Copy the code to a new file in Thonny
  2. Save the file to the Pico as ssd1306.py

you should now be able to import without error.



I believe this is the one as the SDK document specifically mentions the Adafruit OLED.

  • 1
    They look similar and this version may work, but I think the Pi's version should be considered the canonical version in this case, especially given the fact that Adafruit marks it as deprecated on their website. I also don't think the Pi Foundation would remove Adafruit's file header and copyright statement. I think the bigger issue is a documentation error/bug. Jan 28, 2021 at 5:12
  • 1
    Since you are a new user I also removed the non-family-friendly intro to your question rather than flagging it. Jan 28, 2021 at 5:17

Make sure you click the RUN that's at the bottom of the screen (in the window border) and not the tempting one at the top. The one at the top will run your Python code on your computer, which doesn't know what the Machine any other Pico-specific library is. The one at the bottom sends the code to the Pico and runs it there - you can confirm because "Pico Console" will be listed and not "Python".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.