Install#

There are different ways to install BAM Engine:

Dependencies#

Dependency

Version

Purpose

Python

>= 3.11

Core language runtime

numpy

>= 1.26

Vectorized array operations

PyYAML

>= 6.0.2

Configuration file parsing

pandas (optional)

>= 2.0

DataFrame export for results

Installing the latest release#

BAM Engine is available on PyPI. We recommend using a virtual environment to avoid conflicts with other packages.

pip install -U bamengine

To enable DataFrame export for simulation results, install with pandas support:

pip install -U bamengine[pandas]

To enable the optional Numba JIT kernel for the goods market (faster at scale):

pip install -U bamengine[fast]

This installs numba>=0.65 and pins numpy<2.5 (a Numba requirement). The core install is unconstrained (numpy>=1.26). Once installed, the kernel is active by default (goods_kernel="auto"): it compiles once per machine on the first run and is cached to disk for all subsequent runs and processes. Results are bit-identical to the pure-Python path. Measured speedup (warm cache): approximately 1.2x at 100 firms, 2.0x at 1000 firms, and 2.4x at 5000 firms. To disable the kernel without uninstalling Numba, pass goods_kernel="python" to Simulation.init().

Note

The first run with the Numba kernel compiles and caches the JIT kernel (typically a few seconds). All subsequent runs use the cached kernel with no compile cost. The cache is recompiled only when the kernel source, Numba, NumPy, or CPU target changes.

To verify your installation:

python -m pip show bamengine         # show version and location
python -c "import bamengine; print(bamengine.__version__)"

Building from source#

Building from source is required to work on a contribution or to run the latest development version.

git clone https://github.com/kganitis/bam-engine.git
cd bam-engine
pip install -e ".[dev]"

This installs the package in editable mode with all development dependencies (testing, linting, documentation).

To verify the installation, run the test suite:

pytest