Installing Python Packages

numpy, pandas, matplotlib and Pillow need no install: they load by themselves when you import them. For anything else, put !pip install and the package's name at the top of a Python file or a CodeBook cell, the way you would in a notebook:

!pip install plotly
import plotly.graph_objects as go
  • The first run installs it. You'll see "Installing plotly…" while it downloads.
  • Later runs skip it. The package is already there, so the line costs nothing and needs no internet.
  • Several at once: !pip install plotly rich sympy.
  • A version: !pip install "plotly>=5".
  • %pip install works too. Options like -q and --upgrade are accepted and ignored.

Where packages go

Python runs in different places, and Circuitry picks the place for you. Each keeps its own packages:

Where Python runsWhere packages install
In the browserThe page's own Python, for as long as the page is open
On a computer with CircuitA folder of Circuit's own. Your computer's Python is never changed
On iPhone and iPadThe app's own storage, kept between launches

On iPhone and iPad

Circuitry's built-in Python on iPhone and iPad installs packages written purely in Python, such as plotly and rich. Some packages need compiled parts (pandas, scikit-learn, Altair), which only an app update can add. When a file asks for one of those, it runs on the page's Python instead, automatically. numpy, matplotlib and Pillow are already built in.

When it doesn't work

  • "No package called … was found": check the spelling. The name is the one you would give pip on a computer, which is not always the name you import (!pip install scikit-learn, then import sklearn).
  • No internet on the first run: the install needs a connection once. After that the package is there.
  • Scheduled and webhook runs cannot install packages. Keep !pip install to files and cells you run yourself.

Next