Install the NeMo Guardrails Library
Follow these steps to install the NeMo Guardrails library.
Prerequisites
Verify your system meets the following requirements before installation.
Quick Start
Use the following steps to install the NeMo Guardrails library in a virtual environment.
-
Create and activate a virtual environment:
Linux/macOS
Windows (Git Bash)
-
Install the NeMo Guardrails library. Set
NVIDIA_API_KEYto your personal API key generated on build.nvidia.com. -
Set up an environment variable for your NVIDIA API key.
This is required to access NVIDIA-hosted models on build.nvidia.com. The tutorials and example configurations (examples/configs) in this library include configurations that use NVIDIA-hosted models.
Alternative Installation Methods
Install the NeMo Guardrails library from source using pip or Poetry. Choose this method if you want to contribute to the library or use the latest development version.
pip
Poetry
Extra Dependencies
You can install the NeMo Guardrails library with optional extra packages to add useful functionalities. The table below shows a comprehensive list.
Some features such as AlignScore have additional requirements. See the feature documentation for details.
Docker
You can run the NeMo Guardrails library in a Docker container. For containerized deployment, see NeMo Guardrails with Docker.
Troubleshooting Installation Issues
Use the following information to resolve common installation issues.
C++ Runtime Errors
The library uses Annoy, which requires a C++ compiler. Most systems already have one installed. To check, run the following command:
Linux/macOS
Windows
If the command prints a version number (for example, g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0), a C++ compiler is already installed and no action is needed.
If the command is not found, install the compiler: