Installation Guide#

brainpy.state is a flexible, efficient, and extensible framework for computational neuroscience and brain-inspired computation. This guide will help you install brainpy.state on your system.

Requirements#

  • Python 3.10 or later

  • pip package manager

  • Supported platforms: Linux (Ubuntu 16.04+), macOS (10.12+), Windows

Basic Installation#

Install the latest version of brainpy.state:

pip install brainpy.state -U

This will install brainpy.state with CPU support by default.

Hardware-Specific Installation#

Depending on your hardware, you can install brainpy.state with optimized support:

CPU Only#

For CPU-only installations:

pip install brainpy.state[cpu] -U

This is suitable for development, testing, and small-scale simulations.

GPU Support (CUDA)#

For NVIDIA GPU acceleration:

CUDA 12.x:

pip install brainpy.state[cuda12] -U

CUDA 13.x:

pip install brainpy.state[cuda13] -U

Note

Make sure you have the appropriate CUDA toolkit installed on your system before installing the GPU version.

TPU Support#

For Google Cloud TPU support:

pip install brainpy.state[tpu] -U

This is typically used when running on Google Cloud Platform or Colab with TPU runtime.

Ecosystem Installation#

To install brainpy.state along with the entire ecosystem of tools:

pip install BrainX -U

This includes:

  • brainpy.state: Main framework

  • brainstate: State management and compilation backend

  • saiunit: Physical units system

  • braintools: Utilities and tools

  • Additional ecosystem packages

Verifying Installation#

To verify that brainpy.state is installed correctly:

import brainpy_state
import brainpy.state
import brainstate
import saiunit as u

print(f"brainpy.state version: {brainpy_state.__version__}")
print(f"brainstate version: {brainstate.__version__}")

# Test basic functionality
neuron = brainpy.state.LIF(10)
print("Installation successful!")

Development Installation#

If you want to install brainpy.state from source for development:

git clone https://github.com/chaobrain/brainpy.state.git
cd brainpy.state
pip install -e .

This creates an editable installation that reflects your local changes.

Troubleshooting#

Common Issues#

ImportError: No module named ‘brainpy.state’

Make sure you’ve activated the correct Python environment and that the installation completed successfully.

CUDA not found

If you installed the GPU version but get CUDA errors, ensure that:

  1. Your NVIDIA drivers are up to date

  2. CUDA toolkit is installed and matches the version (12.x or 13.x)

  3. Your GPU is CUDA-capable

Version Conflicts

If you’re upgrading from a previous version, you might need to uninstall the old version first:

pip uninstall brainpy.state
pip install brainpy.state -U

Getting Help#

If you encounter issues:

Next Steps#

Now that you have brainpy.state installed, you can: