Install Non-CircuitPython Libraries

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jfbell
 
Posts: 1
Joined: Tue Aug 03, 2021 5:07 pm

Install Non-CircuitPython Libraries

Post by jfbell »

Hi, is it possible to install non-circuitpython libraries on a CPE? Ephem for example (https://pypi.org/project/ephem/)
If so, how?
Thanks

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Install Non-CircuitPython Libraries

Post by dastels »

It depends on two things:

1. What core/other libraries it depends on. CircuitPython is an implementation of the majority of the standard Python (3.something) language, but there are several holes in the core libraries.

2. How big it is. The CircuitPlayground Express (usually shortened to CPX) is built around the SAMD21 (aka M0) MCU which doesn't have a lot of RAM, and CircuitPython (and python generally) likes RAM. The SAMD21 can't handle a lot of involved code. A SAMD51, nRF52840, or ESP32-S2 are better choices for more complex applications.

How? Just copy the code into CIRCUITPY/lib. It's best if you precompile it to bytecode with mpy-cross (version matching that of CircuitPython you are using) so that it will consume less RAM when loading (compiling takes space in addition to the resulting bytecode).

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”