Prerequisites
Before installing NeMo Guardrails, ensure your system meets the following requirements:Python Version
NeMo Guardrails supports the following Python versions:- Python 3.10
- Python 3.11
- Python 3.12
- Python 3.13
C++ Compiler and Dev Tools
NeMo Guardrails uses annoy, a C++ library with Python bindings for efficient similarity search. You’ll need a C++ compiler and development tools installed on your system.- macOS
- Linux (Ubuntu/Debian)
- Linux (RHEL/CentOS/Fedora)
- Windows
Install Xcode Command Line Tools:This provides the necessary C++ compiler (clang) and build tools.
Installation
Install via pip
The simplest way to install NeMo Guardrails is using pip:This installs the core package with all essential dependencies.
Verify Installation
Verify that NeMo Guardrails is installed correctly:You should see the help menu with available commands:
Optional Dependencies
NeMo Guardrails supports optional features through extras. Install them based on your needs:Optional Dependencies Details
openai - OpenAI and LangChain OpenAI Support
openai - OpenAI and LangChain OpenAI Support
Includes:
openai- Official OpenAI Python clientlangchain-openai- LangChain integrations for OpenAI models
eval - Evaluation and Benchmarking Tools
eval - Evaluation and Benchmarking Tools
Includes:
tqdm- Progress bars for evaluationnumpy- Numerical computingstreamlit- Web UI for evaluation resultstornado- Web server framework
nemoguardrails evaluate command.sdd - Sensitive Data Detection
sdd - Sensitive Data Detection
Includes:
presidio-analyzer- PII detection and analysispresidio-anonymizer- PII anonymization
gcp - Google Cloud Platform Integration
gcp - Google Cloud Platform Integration
Includes:
google-cloud-language- Google Cloud Natural Language API
nvidia - NVIDIA AI Endpoints
nvidia - NVIDIA AI Endpoints
Includes:
langchain-nvidia-ai-endpoints- LangChain integration for NVIDIA NIM
tracing - OpenTelemetry Tracing
tracing - OpenTelemetry Tracing
Includes:
opentelemetry-api- OpenTelemetry APIaiofiles- Async file operations
jailbreak - Jailbreak Detection
jailbreak - Jailbreak Detection
Includes:
yara-python- Pattern matching for jailbreak detection
multilingual - Language Detection
multilingual - Language Detection
Includes:
fast-langdetect- Fast language detection
server - Server Features
server - Server Features
Includes:
aiofiles- Async file operationsopenai- OpenAI client for server endpoints
nemoguardrails server with full features.Development Installation
For contributing to NeMo Guardrails or running tests, install from source:Docker Installation
You can also run NeMo Guardrails in a Docker container:For detailed Docker usage, see the Using Docker guide in the official documentation.
Environment Variables
For using LLM providers, you’ll typically need API keys set as environment variables:OpenAI
Anthropic
Cohere
Troubleshooting
Error: Microsoft Visual C++ 14.0 or greater is required
Error: Microsoft Visual C++ 14.0 or greater is required
Windows users: Install Microsoft C++ Build Tools as described in the prerequisites section.
Error: command 'gcc' failed
Error: command 'gcc' failed
Linux/macOS users: Install build tools and Python development headers:
Ubuntu/Debian
macOS
ImportError: No module named 'annoy'
ImportError: No module named 'annoy'
The annoy library didn’t install correctly. This usually means the C++ compiler isn’t available. Install the required build tools for your platform.
Version conflicts with existing packages
Version conflicts with existing packages
Consider using a virtual environment to isolate dependencies:
Next Steps
Quickstart Guide
Now that you have NeMo Guardrails installed, follow the quickstart guide to create your first guardrails configuration.