Installation
Install Python
ScenicRules requires Python 3.10 or higher. If you don’t have a compatible Python version, you can download it from the official Python website or use pyenv to install it as follows.
pyenv install 3.10.18
Set up a Python Virtual Environment
We recommend installing ScenicRules within an isolated Python virtual environment to prevent dependency conflicts. We provide two options for setting up the environment:
Option 1: Using venv
You can create and activate a virtual environment using Python’s built-in venv module as follows.
# Create a virtual environment named "venv_scenicrules"; you only need to do this once
python3 -m venv venv_scenicrules
# Activate the virtual environment; you need to do this every time you start a new terminal session
source venv_scenicrules/bin/activate
Option 2: Using pyenv+virtualenv
Alternatively, you can use pyenv along with pyenv-virtualenv to manage your Python versions and virtual environments. You can create and activate a virtual environment as follows.
# Create a virtual environment named "venv_scenicrules" with Python 3.10.18; you only need to do this once
pyenv virtualenv 3.10.18 venv_scenicrules
# Activate the virtual environment; you need to do this every time you start a new terminal session
pyenv activate venv_scenicrules
Install ScenicRules
After activating your Python virtual environment, you can install ScenicRules directly from the repository.
Note
The scenic and hydra-core dependencies have a version conflict regarding the antlr4-python3-runtime package. To resolve this automatically, we use the uv package manager.
Run the following commands to install the package:
git clone https://github.com/BerkeleyLearnVerify/ScenicRules.git
cd ScenicRules
python -m pip install uv
python -m uv pip install -e .
The -e flag installs ScenicRules in editable mode, allowing any local code changes to take effect immediately without requiring reinstallation.