Runtime & Environment Errors¶
Base Classes: EnvironmentConfigurationError, InvalidEnvVariable, MissingDependencyError
Runtime and environment errors occur when the system detects issues with the runtime environment, configuration, or dependencies. These errors can happen at various stages and are typically caused by missing dependencies, invalid environment variables, or incorrect environment setup.
MissingDependencyError¶
Required dependency is not installed.
Overview¶
This error occurs when a required Python package or system library is not installed in the environment. Different model backends (ONNX, TensorRT, PyTorch) require different dependencies.
When It Occurs¶
Scenario 1: ONNX backend dependencies missing
-
onnxruntimenot installed -
Wrong ONNX Runtime variant for your hardware (CPU vs GPU)
-
Missing CUDA-specific ONNX Runtime for GPU
Scenario 2: TensorRT backend dependencies missing
-
tensorrtnot installed -
pycudanot installed -
TensorRT version incompatible with system
Scenario 3: Model-specific dependencies missing
-
SAM/SAM2 models require additional packages
-
MediaPipe models need
mediapipepackage -
Vision-language models need transformers/tokenizers
Scenario 4: CUDA dependencies missing
-
pycudanot installed for GPU operations -
CUDA toolkit not installed on system
-
Incompatible CUDA version
What To Check¶
-
Check which backend you're using:
-
Review the error message:
-
Error message specifies which dependency is missing
-
Lists required package extras to install
-
Indicates which backend needs the dependency
-
Check your installation:
How To Fix¶
Visit our installation guide: Installation Guide to find out how to install dependencies for your specific use case.
EnvironmentConfigurationError¶
Invalid environment configuration detected.
Overview¶
This error occurs when the environment is configured incorrectly, typically when required environment variables are missing or when execution providers are not properly set up.
When It Occurs¶
Scenario 1: ONNX execution providers not configured
-
ONNXRUNTIME_EXECUTION_PROVIDERSenvironment variable not set and noonnx_execution_providerspassed toAutoModel.from_pretrainedmethod -
No execution providers specified in code
-
Empty execution providers list
What To Check¶
- Check ONNX execution providers:
How To Fix¶
Set ONNX execution providers:
# For CPU only
export ONNXRUNTIME_EXECUTION_PROVIDERS="CPUExecutionProvider"
# For GPU (CUDA)
export ONNXRUNTIME_EXECUTION_PROVIDERS="CUDAExecutionProvider,CPUExecutionProvider"
# For TensorRT
export ONNXRUNTIME_EXECUTION_PROVIDERS="TensorrtExecutionProvider,CUDAExecutionProvider,CPUExecutionProvider"
Or specify in code:
from inference_models import AutoModel
# Specify execution providers explicitly
model = AutoModel.from_pretrained(
"yolov8n-640",
backend="onnx",
onnx_execution_providers=["CUDAExecutionProvider", "CPUExecutionProvider"]
)
InvalidEnvVariable¶
Environment variable has an invalid value.
Overview¶
This error occurs when an environment variable is set to an invalid value, typically when a boolean variable receives a non-boolean value.
When It Occurs¶
Scenario 1: Invalid boolean value
-
Environment variable expects "true" or "false"
-
Received numeric value (0, 1)
-
Received other string value
Scenario 2: Wrong data type
-
Variable expects string but receives other type
-
Type conversion fails
What To Check¶
-
Review error message:
-
Shows which variable has invalid value
-
Shows what value was provided
-
Indicates expected format
-
How To Fix¶
Fix boolean environment variables:
# ❌ Wrong - numeric values
export RUNNING_ON_JETSON=0
# ✅ Correct - use "true" or "false"
export RUNNING_ON_JETSON="false"
Running on Roboflow platform?
This is most likely a bug you need to report.