Installation
In this section, the installation procedure for ctrl-freeq is described. The package may be obtained either from PyPI, where both stable and pre-release versions are published, or directly from the GitHub repository.
Requirements
- Python 3.11–3.14 (required)
- A working installation of
piporuv
Core Dependencies
Ctrl-freeq automatically installs the following dependencies:
| Package | Purpose |
|---|---|
numpy |
Numerical computing |
matplotlib |
Plotting and visualization |
torch (PyTorch) |
Tensor operations and GPU acceleration |
pytorch-minimize |
Gradient-based optimization on PyTorch tensors |
scipy |
Scientific computing |
qiskit |
Quantum computing framework |
qiskit-algorithms |
Optimization algorithms |
panel |
Dashboard generation |
Note
It should be noted that the PyPI distribution name is ctrl-freeq, which differs from the Python import path ctrl_freeq.
Install from PyPI
Stable Releases
The latest stable version may be installed via pip:
Beta (Pre-release) Versions
Pre-releases follow standard Python packaging conventions (PEP 440) and are not installed by default.
The latest available pre-release may be installed as follows:
A specific beta version may also be requested:
Finding Available Versions
All available versions may be viewed on PyPI.
Install from GitHub
Install the Latest Commit from main
Install a Specific Branch or Tag
# Install from a specific branch
pip install "ctrl-freeq @ git+https://github.com/mforoozandeh/ctrl-freeq.git@branch-name"
# Install from a specific tag
pip install "ctrl-freeq @ git+https://github.com/mforoozandeh/ctrl-freeq.git@v0.1.0"
Editable/Development Install
For development or contributing purposes, the package may be installed in editable mode:
git clone https://github.com/mforoozandeh/ctrl-freeq.git
cd ctrl-freeq
# Using uv (recommended) — installs with all dependency group
uv sync --all-groups
# Or using pip — installs the package in editable mode (without dev dependencies)
pip install -e .
Dependency Groups
Development dependencies (pytest, jupyter, etc.) are defined as dependency groups in pyproject.toml. These are installed via uv sync --group dev. It should be noted that the pip install -e .[dev] syntax does not support dependency groups.
Using uv (Recommended Package Manager)
As an alternative to pip, the uv package manager may be employed, which offers certain advantages in dependency resolution and environment management:
# Install from PyPI
uv pip install ctrl-freeq
# Install pre-release
uv pip install --prerelease=allow ctrl-freeq
# Development install with dependency groups
git clone https://github.com/mforoozandeh/ctrl-freeq.git
cd ctrl-freeq
uv sync --all-groups
Verify the Installation
Launch the GUI
If the command is found and the graphical interface window opens successfully, the installation is complete.
Verify in Python
from ctrl_freeq.api import CtrlFreeQAPI, load_single_qubit_config
# Load a built-in example configuration
api = load_single_qubit_config()
print(api.get_config_summary())
Check Version
Upgrading
Upgrade to Latest Stable
Upgrade to Latest Pre-release
GPU Support (Optional)
Ctrl-freeq supports GPU acceleration via the CUDA backend of PyTorch. To enable GPU support, the following steps should be followed:
- Ensure that a CUDA-compatible NVIDIA GPU is available
- Install PyTorch with CUDA support:
- Verify CUDA availability:
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"CUDA device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'N/A'}")
A detailed treatment of GPU configuration is provided in Compute (CPU/GPU).
Bloch-Sphere Video (Optional)
For single-qubit runs, the dashboard shows the Bloch-sphere dynamics as a video rendered by nutate. It is installed with the video extra:
The extra adds PyVista and VTK. Without it, the dashboard omits the Bloch-sphere card. What the video shows is described in Dashboard → Bloch-Sphere Video.
Videos are rendered off-screen, in a separate process. On a machine without a display (a server, a cluster, a container), VTK crashes when it cannot open an OpenGL context; ctrl-freeq then skips the Bloch-sphere card, prints why, and saves everything else. To render there on Debian or Ubuntu, install OSMesa and select VTK's off-screen window:
Troubleshooting
Common Issues
freeq-gui command not found
It should be verified that the package is installed and that the Python scripts directory is included in the system PATH:
Import errors
All dependencies may be reinstalled by upgrading the package:
Tkinter not available
The GUI requires Tkinter, which may need to be installed separately on certain systems:
CUDA/GPU issues
If GPU mode fails, the following steps may be taken:
- Verify the PyTorch CUDA installation:
python -c "import torch; print(torch.cuda.is_available())" - Check CUDA driver compatibility with the installed PyTorch version
- Fall back to CPU mode by setting
compute_resource: "cpu"in the configuration
Uninstalling
Next Steps
- API Reference — Use ctrl-freeq programmatically
- GUI Guide — Configure and run optimization interactively
- Optimization Parameters — Understand configuration options