Installation#
This guide covers the installation of eegprep and its dependencies.
System Requirements#
Before installing eegprep, ensure your system meets the following requirements:
Python: 3.12 or higher
uv: Default package and environment manager for source installs and development
pip: Optional fallback for published package installs
conda: Optional environment manager when required by a local setup
Operating System: Linux, macOS, or Windows
RAM: Minimum 4GB (8GB+ recommended for large datasets)
Disk Space: At least 500MB for installation and dependencies
Installation Methods#
Using uv (Recommended)#
For a project managed by uv, add the eegprep package with:
uv add eegprep
This installs EEGPrep. It does not install the separate eegprep-lean
distribution (import name eegprep_lean). NumPy, SciPy, Matplotlib,
psutil, pyedflib, and h5py are part of this base install. Loading, cleaning,
plotting, and EDF, BDF, and GDF export work with no brackets.
Octave, MNE, PyBIDS, and Picard are extras. Install them together with:
uv add "eegprep[full]"
To include every optional extra, including the GUI, console, docs, and classifier dependencies:
uv add "eegprep[all]"
Using pip#
Published EEGPrep packages can also be installed with pip in non-uv environments:
pip install eegprep
From Source#
To install eegprep from source for development:
git clone https://github.com/sccn/eegprep.git
cd eegprep
uv sync --group dev
uv sync creates the project environment, installs EEGPrep in editable mode,
and uses uv.lock for reproducible dependency resolution. The development
environment includes the GUI and console runtime dependencies, so a fresh
checkout can immediately launch uv run eegprep-console --full. It also
installs the eeglab, mne, pybids, and picard packages so the
test suite can exercise Octave, MNE conversion, BIDS import, and Picard ICA.
To develop or build documentation from source, include the docs extra:
uv sync --group dev --extra docs
Optional Dependencies#
eegprep has several optional dependencies that enable additional functionality.
Calling a function whose extra is not installed raises ImportError. The
message names the library, the function, and the command to install it, for
example pip install "eegprep[mne]", and it mentions eegprep[full].
When another path does not need that library, the message says what to do
instead, such as leaving engine unset or using runica.
dir(eegprep) lists every public name. eegprep.help() prints those
names with a one-line summary, read from the function’s docstring without
importing its module, and names the extra when one path of the function needs
it. help is not exported by from eegprep import *.
full restores the previous base install#
uv add "eegprep[full]"
This installs four extras:
eeglab(oct2py), the Octave runtime forpop_resample(..., engine="octave"),iclabel(..., engine="octave"), the RANSAC octave subroutine used byclean_channels, andeeglab_clean_artifacts.mne, conversion to and from MNE objects, and the EDF, BDF, GDF, and EGI.mffreaders inpop_biosigandpop_fileio. BrainVision.eegfiles, and.vhdrfiles when a block range is set, also use it. EEGLAB.set, CNT, BrainVision.vhdrwithout a block range, and BrainVision Analyzer.matexports do not.pybids, BIDS import andbids_preproc.picard(python-picard), Picard ICA. The defaultrunicapath does not need it. This extra also installs scikit-learn.
eegprep[all] includes these four extras plus the GUI, console, docs, and
PyTorch extras.
Riemannian ASR (clean_asr(..., useriemannian=True) and
Distance="Riemannian") is included. It uses NumPy and SciPy; there is no
separate manifold package to install.
PyTorch (for GPU acceleration)#
To use GPU-accelerated processing with PyTorch:
uv add torch
For CUDA support (NVIDIA GPUs):
uv add torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
For CPU-only PyTorch:
uv add torch --index-url https://download.pytorch.org/whl/cpu
pAMICA#
pAMICA is a Python implementation of AMICA built on PyTorch.
It needs no executable.
Install it with the pamica extra, which also installs PyTorch:
uv add "eegprep[pamica]"
pop_runica(EEG, icatype="pamica") and eeg_pamica use it.
The extra is part of eegprep[all] and not of eegprep[full].
AMICA#
EEGPrep can run AMICA through eeg_amica and ICAAlgorithm='amica', but
published EEGPrep packages do not include AMICA binaries. This keeps Python
package downloads smaller and avoids shipping platform-specific executables.
To use AMICA, install or download an AMICA executable separately, then provide it in one of these ways:
export AMICA_BINARY=/path/to/amica15ub
or pass the path directly:
eeg = eeg_amica(eeg, amica_binary="/path/to/amica15ub")
Source checkouts may contain development binaries under src/eegprep/bin/.
Those files are for local development and tests, not for package distribution.
Documentation Building#
To build the documentation locally:
uv sync --group dev --extra docs
uv run --no-sync sphinx-build -b html docs/source docs/_build/html
The docs/Makefile target is also available:
uv run --no-sync make -C docs html
All Optional Dependencies#
To install all optional dependencies at once:
uv add "eegprep[all]"
Or with specific extras:
uv add "eegprep[torch,gui,docs]"
eegprep-lean#
The commands on this page install EEGPrep. They do not install the separate
eegprep-lean distribution (import name eegprep_lean). In Pyodide that
package reads with PyfetchTransport(timeout_s=60). The browser request is
aborted if the response headers and the body have not both arrived within
timeout_s seconds. A host that registers its own client with
FetchTransport keeps that client’s deadline. eegprep-lean does not
add a second one.
Verification#
After installation, verify that eegprep is correctly installed by running:
import eegprep
print(eegprep.__version__)
eegprep.help()
You should see the version number, then a list of public names, printed without any errors.
To verify all core modules are available:
from eegprep import (
pop_loadset,
pop_saveset,
clean_artifacts,
iclabel,
pop_resample,
pop_reref,
topoplot
)
print("All core modules imported successfully!")
Troubleshooting#
Import Errors#
Problem: ModuleNotFoundError: No module named 'eegprep'
Solution: Ensure eegprep is installed:
uv add eegprep
If installing from source, ensure you’re in the correct directory and use:
uv sync --group dev
Version Conflicts#
Problem: Conflicts with NumPy, SciPy, or other dependencies
Solution: Create a fresh virtual environment:
uv venv eegprep_env
source eegprep_env/bin/activate # On Windows: eegprep_env\Scripts\activate
uv pip install eegprep
PyTorch Installation Issues#
Problem: PyTorch installation fails or GPU not detected
Solution:
Check your CUDA version:
nvidia-smi
Install the matching PyTorch version from https://pytorch.org/get-started/locally/
Verify PyTorch installation:
import torch
print(torch.cuda.is_available())
EEGLAB File Format Issues#
Problem: Cannot read .set files
EEGPrep reads .set files directly with SciPy (scipy.io.loadmat) and
h5py for newer MATLAB v7.3 files, and writes them with
scipy.io.savemat. These libraries are installed automatically, so a load
failure is almost always a path or format problem rather than a missing
dependency.
Solution: Check that the path points at an existing .set file and that
any companion .fdt data file sits next to it:
from pathlib import Path
from eegprep import pop_loadset
path = Path("sub-01_task-rest_eeg.set")
assert path.is_file(), f"no such file: {path}"
EEG = pop_loadset(str(path))
Memory Issues#
Problem: Out of memory errors when processing large datasets
Solution:
Process data in chunks or epochs
Reduce the number of channels if possible
Increase available RAM or use a machine with more memory
Use GPU acceleration if available
Getting Help#
If you encounter issues not covered here:
Check the FAQ section
Review the troubleshooting sections in this installation guide and FAQ
Visit the GitHub Issues page
Check the Functions
Next Steps#
After successful installation, proceed to the Quick Start guide to learn how to use eegprep.