00 · Setup¶
You will learn how to install synaptome and Jupyter in an environment of your own, so that every tutorial runs, and how to check that the installation works.
You need Python 3.10 or newer, and a terminal. You can read this page before installing anything: the commands to type are in the text, and the code cells at the end check the result.
1. Get the code¶
synaptome is not on PyPI yet, so you install it from a copy of its repository (the package is named
mindmap-synaptome, part of the mindmap collection, and imported as synaptome):
git clone https://github.com/NinoHerve/mindmap-synaptome.git
cd mindmap-synaptome
Every command below is run from this mindmap-synaptome folder.
2. Create an environment and install¶
An environment keeps synaptome and its dependencies apart from your other projects. Pick the tool you already use; all three give the same result.
In each case, pip install -e . reads synaptome's pyproject.toml and installs everything synaptome needs
(NumPy, pandas, SciPy, Matplotlib, PyArrow). You only add JupyterLab, to open the notebooks:
synaptome itself doesn't need it.
-e means editable: Python uses the code in this folder directly, so after git pull you get the new
version without reinstalling (restart the notebook kernel to pick it up).
conda (Anaconda, Miniconda, Miniforge)
conda create -n synaptome python=3.12
conda activate synaptome
pip install -e . jupyterlab
venv (built into Python)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e . jupyterlab
uv
uv sync
uv run --with jupyterlab jupyter lab tutorials
With uv there is nothing to activate: uv sync builds the environment from pyproject.toml, and
uv run starts JupyterLab inside it.
3. Open the tutorials¶
With conda or venv, activate the environment, then:
jupyter lab tutorials
Already have Jupyter elsewhere? You can keep it, and register this environment as a kernel instead. From the activated environment:
pip install ipykernel
python -m ipykernel install --user --name synaptome --display-name "Python (synaptome)"
Then choose Python (synaptome) in the notebook's kernel menu.
4. Check the installation¶
Run the cells below. The first one says which Python the notebook is using: it should be inside the
environment you just created (a path containing synaptome or .venv). If it isn't, the notebook is on
the wrong kernel (see section 3).
import sys
print(sys.executable)
print("Python", sys.version.split()[0])
assert sys.version_info >= (3, 10), "synaptome needs Python 3.10 or newer."
/home/runner/work/mindmap-synaptome/mindmap-synaptome/.venv/bin/python Python 3.12.16
synaptome and the libraries it relies on, with their versions:
from importlib.metadata import version
import synaptome as syn
print("synaptome", syn.__version__)
for package in ["numpy", "pandas", "scipy", "matplotlib", "pyarrow"]:
print(f"{package:<10}", version(package))
synaptome 0.1.0 numpy 2.5.3 pandas 3.0.6 scipy 1.18.1 matplotlib 3.11.2 pyarrow 25.0.1
Finally, a tiny study saved to a temporary file and read back. If this cell prints True, everything
the tutorials use is working. (Don't worry about the code yet: tutorial 01 explains it.)
import tempfile
from pathlib import Path
import pandas as pd
study = syn.Study("Setup check")
study.add_units("subject", pd.DataFrame({"subject": ["s01", "s02"], "group": ["A", "B"]}))
with tempfile.TemporaryDirectory() as folder:
again = syn.load(study.save(Path(folder) / "check.syn"))
print(again.table("subject").equals(study.table("subject")))
True
/tmp/ipykernel_2526/607539463.py:7: InferenceNotice: Inferred definitions for subject variables: group: category @ subject. Review them with study.variables, or define them explicitly.
study.add_units("subject", pd.DataFrame({"subject": ["s01", "s02"], "group": ["A", "B"]}))
You may also see an InferenceNotice warning above the result. That is synaptome telling you how it read the
group column. Tutorial 01 explains it.
If something goes wrong¶
| Message | What it means | Fix |
|---|---|---|
ModuleNotFoundError: No module named 'synaptome' |
The notebook runs on another Python | Pick the right kernel (section 3), or activate the environment before jupyter lab |
pip: command not found, or packages land elsewhere |
The environment isn't active | conda activate synaptome or source .venv/bin/activate, then retry |
ERROR: ... does not appear to be a Python project |
pip install -e . was run outside the repository |
cd into the synaptome folder first |
requires a different Python |
Python older than 3.10 | Create the environment with python=3.12 |
Next: 01 · Quickstart turns a pandas DataFrame into a study and saves it.