Before the workshop: check your setup#
Allow 10 minutes after installation. Select Python (napari workshop) in Jupyter’s kernel selector. Click a code cell and press Shift+Enter to run it. A number appears beside a completed cell; [*] means it is still working.
You will use three windows: the terminal starts Jupyter; your browser contains these instructions; napari opens as a separate desktop window. Keep the terminal open. Complete the installation instructions or Mac instructions first.
This notebook checks your selected kernel. A standalone script run by uv can have its own environment, so its success alone does not identify the environment selected here.
import sys
import platform
import importlib.metadata as packages
print("Python:", sys.executable)
print("Computer:", platform.system(), platform.machine())
for name in ("napari", "numpy", "ipykernel", "imageio-ffmpeg"):
print(name, packages.version(name))
Check: the Python path should contain the workshop environment (.venv on your laptop). This release uses napari 0.6.6 and Python 3.12. If an import fails, check the kernel before reinstalling anything. import makes an installed package available in this running notebook.
from pathlib import Path
ROOT = next(p for p in (Path.cwd(), *Path.cwd().parents)
if (p / "data" / "zenodo-manifest.json").is_file())
DATA = ROOT / "data" / "teaching"
print(DATA)
The / symbol above joins folder names portably on Windows and Mac. The helper finds the workshop folder from your current notebook location. Download and extract the teaching data before continuing. The 42.8 MB teaching dataset is a spatially reduced derivative of the original dataset.
print("Teaching metadata present:", (DATA / "metadata.json").is_file())
print("First image present:", (DATA / "ch0" / "frame_000000.tif").is_file())
Check graphics with a tiny practice object#
%gui qt lets the notebook and napari’s window respond at the same time. The small array below contains a bright sphere. This practice image is synthetic, not an experimental result. Run the cell, find the napari window, and drag to rotate the sphere.
%gui qt
import numpy as np
import napari
z, y, x = np.indices((32, 32, 32))
sphere = ((z - 16)**2 + (y - 16)**2 + (x - 16)**2 < 100).astype("uint8")
viewer = napari.Viewer(ndisplay=3)
viewer.add_image(sphere, name="Practice sphere")
Check: a sphere appears and rotates. A successful import with an empty/black/broken window is not a passed graphics check. See troubleshooting. Close the practice viewer with the next cell before the course; closing napari does not close Jupyter.
viewer.close()
Check movie encoding in this kernel#
The command below starts the check script using this notebook’s Python executable. It writes and reads three tiny movie frames in a temporary folder. No large image is loaded and no system-wide FFmpeg installation is required if the packaged encoder works.
import subprocess
subprocess.run([sys.executable, str(ROOT / "scripts" / "check_setup.py"), "--movie"], check=True)
Ready when: the correct Python path is shown, both data checks say True, the sphere rotates, and the movie check succeeds. Write down your OS, processor type, RAM, and any problem before the workshop. Windows and macOS instructions need a real pilot on those platforms; the included validation report records which tests have actually been performed.