Installation
Requirements
- Python 3.11 or higher
- pip (Python package manager)
Basic Installation
# Clone the repository
git clone https://github.com/Ayush12358/ElectoralSim.git
cd ElectoralSim
# Install in editable mode
pip install -e .
Optional Dependencies
Visualization
For charts, plots, and the Streamlit dashboard:
This installs:matplotlib, plotly, streamlit
GPU Acceleration
For CUDA-accelerated simulations with large voter populations:
This installs:cupy
Note: GPU support requires NVIDIA CUDA toolkit. See CuPy installation guide.
Development
For running tests and contributing:
This installs:pytest, pytest-cov
All Dependencies
Verification
Test your installation:
from electoral_sim import ElectionModel
model = ElectionModel(n_voters=1000, seed=42)
results = model.run_election()
print(f"Installation successful! Turnout: {results['turnout']:.1%}")
Troubleshooting
ImportError: No module named 'mesa'
Numba warnings
Numba JIT compilation warnings on first run are normal. They disappear after the first execution.
GPU not detected
Ensure CUDA is installed and cupy can access your GPU: