Independent developer project · not affiliated with, endorsed by, or sponsored by BrainChip Holdings Ltd. Akida and AKD1500 are their trademarks.

06 — Two Python environments

The runtime needs numpy 1.x for the camera; training needs numpy 2 for cnn2snn. One process boundary solves it.

OUR OBSERVATIONEvent 2026-09-07Published 2026-09-27SE Inspect build 1.9.37

Why two

Both in one environment means either no camera or no training. The fix is architectural: the server lives in ~/akida-env (numpy 1.26.4); training runs as a subprocess in ~/m3-train-env (numpy 2.1.3), talks to the server over a line protocol (@PHASE|@STEP|@MELDE|@ERGEBNIS|@FEHLER), and the server loads the resulting .fbz onto the card itself.

Runtime environment (camera + inference — never TensorFlow here)

python3 -m venv ~/akida-env --system-site-packages
source ~/akida-env/bin/activate
pip install --upgrade pip
pip install akida==2.19.3
pip install "numpy<2" opencv-python pyserial

--system-site-packages is what makes picamera2 (a system package) visible inside the venv.

python3 -c "import akida,cv2,numpy; from picamera2 import Picamera2; print(akida.devices(), numpy.__version__)"

Expected: a list like [PCIe/AKD1500/16MB/0, PCIe/AKD1500/16MB/1, …] and 1.26.x. If the list is empty, go back to chapter 05. If numpy prints 2.x, run pip install "numpy<2" again — something pulled numpy 2 in.

Training environment (only if you will train the M3 detector)

bash ~/vorsa-m3/setup_m3_train.sh

The script creates ~/m3-train-env deliberately without --system-site-packages, pins numpy 2.1.3 first, then installs tensorflow 2.19.0, tf_keras 2.19.0, cnn2snn 2.19.3, akida 2.19.3 and opencv-python-headless. It takes 10–20 minutes on the Pi.

~/m3-train-env/bin/python -c "import numpy,cv2,tensorflow,cnn2snn,akida; print('train-env ok', numpy.__version__)"

Expected: train-env ok 2.1.3.

The server finds the training interpreter automatically at ~/m3-train-env/bin/python; a different location goes into VORSA_M3_PY. No server restart is needed — the next training run uses it.

Version matrix (what "reproduced" means here)

Package Runtime env Training env
numpy 1.26.4 2.1.3
akida 2.19.3 2.19.3
opencv opencv-python (any 4.x/5.x on numpy 1) opencv-python-headless
tensorflow / tf_keras — 2.19.0 / 2.19.0
cnn2snn — 2.19.3
pyserial yes (arm) —

Checkpoint: the runtime check lists the cards with numpy 1.26.x; the training check (if installed) prints numpy 2.1.3.