Installation#
Draft Checked on 2026-11-30 on Windows 11 (Python 3.12.9, no GPU), each time in a new virtual environment: pip install harmolab (version 0.0.1, from PyPI), then the code of the First simulation run from an empty folder; and pip install -e ".[export,optim,test]" in a fresh clone (commit a1fdf70), then the test suite, with test/interface/test_project.py of commit c19a44f. Awaiting review.
HarmoLab is a Python package, harmolab, published on PyPI. It
needs Python 3.12 or later. A GPU is optional. There are two ways to install it:
from PyPI, to use the solver in your own scripts and notebooks;
from a clone of the repository, to work on the code, or to run the example notebooks, the test suite or the graphical interface, which are not part of the package.
Install from PyPI#
In a new virtual environment:
python -m venv .venv
.venv\Scripts\activate # Windows; on Linux or macOS: source .venv/bin/activate
python -m pip install harmolab
Or with Conda:
conda create --name harmolab python=3.12
conda activate harmolab
python -m pip install harmolab
import harmolab then works from any folder. On the checking machine the install took less than two
minutes, with nothing in pip’s cache, and the virtual environment takes about 470 MB on disk.
Jupyter is not installed with the solver: to run the First simulation in a notebook, add it
with python -m pip install notebook.
Optional extras are installed with the package, in any combination, for example
python -m pip install "harmolab[export,optim]":
Extra |
Installs |
Needed for |
|---|---|---|
|
|
saving the Plotly figures as images ( |
|
|
the Bayesian outer loop of the optimiser ( |
|
|
the GPU assembly of the impedance matrix, with a CUDA 12.x driver (see GPU acceleration) |
|
|
the test suite, which is only in a clone |
Install from a clone#
git clone https://github.com/FahdilOuro/harmolab.git
cd harmolab
conda create --name harmolab python=3.12 # or a virtual environment, as above
conda activate harmolab
python -m pip install -e ".[export,optim,test]"
The last line installs the harmolab package in editable mode, with three of its extras: import harmolab works from any folder (the example notebooks, which live in subfolders, need it), and
changes to the code in the repository take effect without reinstalling. On the checking machine it
took about a minute and a half.
Then, as needed:
Jupyter, for the example notebooks of
harmolab/antenna_simulation/:python -m pip install notebook, thenjupyter notebookfrom the folder you want to work in;the graphical interface (
python -m interface.gui):python -m pip install PySide6 pyvista pyvistaqt, seeinterface/README.md.
requirements.txt lists all of these packages at once, for python -m pip install -r requirements.txt
followed by python -m pip install -e .. It also lists numba and scikit-rf, kept for planned work:
no code of the solver imports them at the moment.
What is installed#
pip install harmolab installs:
Package |
Used for |
|---|---|
|
everything numerical: assembly, linear algebra, quadrature, optimisation |
|
drawing geometries and meshing them ( |
|
interactive 3D views: surface currents, patterns |
|
2D plots: polar cuts, sweeps, Smith chart, CMA plots |
|
assembling the rotating GIFs of the patterns ( |
About the optional packages:
kaleido (
export) exports the Plotly figures as images. To do so,kaleido1.x drives a Chromium-based browser installed on the machine (Chrome, Chromium, Edge, Brave or Vivaldi) and raisesChromeNotFoundErrorif it finds none.CuPy (
gpu) must match the CUDA version of your driver, shown bynvidia-smi: thegpuextra installscupy-cuda12x, for CUDA 12.x; for another version, install the matching CuPy wheel instead. Without CuPy, or without a usable NVIDIA GPU, everything runs on the CPU.threadpoolctl (
optim) runs the BLAS on one thread in the optimisation loops (harmolab/optim/threads.py); without it they work and print a warning once.
Check the installation#
python -c "import harmolab.utils.impedance.compute_backend as cb; print(cb.describe_backend())"
prints the compute backend the solver found: GPU (NVIDIA ..., CuPy ...), or CPU (no usable CUDA GPU detected: ...) followed by the reason. On the checking machine, without CuPy:
CPU (no usable CUDA GPU detected: ModuleNotFoundError("No module named 'cupy'")).
From a clone, run the test suite as well:
python -m pytest test/
On the fresh clone of 2026-11-30 (without PySide6), 389 tests passed and 4 were skipped, in a few minutes.
Platforms#
The solver is developed and tested on Windows 11. The package from PyPI also installs and imports on
Ubuntu 24.04 under WSL 2 (checked on 2026-11-30: imports only, no simulation run). On recent Ubuntu
and Debian, pip refuses to install into the system Python (error: externally-managed-environment,
PEP 668): use a virtual environment as above, created with python3 -m venv .venv (install the
python3-venv package first if that command is missing).
Long paths on Windows. Windows limits file paths to 260 characters unless long-path support is
enabled, and some files of JupyterLab (installed with notebook) are deep. With an environment created
in a deeply nested folder, installing Jupyter then stops with
OSError: [Errno 2] No such file or directory and a hint about long paths; this happened on
2026-11-11 on the checking machine with a virtual environment in a temporary folder. Create the
environment in a short path (the Conda default, or .venv in your working folder), or enable
long-path support as the hint explains.
On Windows, when the output of Python is redirected to a file or a pipe, it is
encoded in the legacy code page (cp1252), which has no λ, Ω or ✓. The solver’s own messages then fall back to
ASCII (λ → lambda, Ω → Ohm), but a print() of your own with such characters fails with a
UnicodeEncodeError; running Python with -X utf8, or setting the environment variable
PYTHONUTF8=1, avoids it (see Troubleshooting).
Next#
A half-wave dipole in four steps
Installing CuPy and choosing use_gpu