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. .. code-block:: bash 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. .. code-block:: bash # 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. .. code-block:: bash # 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: .. code-block:: bash 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.