BerriAI/litellm · error · NvidiaRivaException

NVIDIA Riva client is not installed. Install with `pip…

Error message

NVIDIA Riva client is not installed. Install with `pip install 'litellm[stt-nvidia-riva]'`.

What it means

LiteLLM's NVIDIA Riva audio transcription provider lazily imports the `riva.client` SDK only when a transcription request is made. If the import raises ImportError, LiteLLM wraps it in an NvidiaRivaException (HTTP 500) with the install hint instead of crashing at module load. This keeps the Riva extra optional: the failure only surfaces when you actually call the Riva transcription path.

Solutions

  1. Install the extra in the same environment that runs LiteLLM: pip install 'litellm[stt-nvidia-riva]'
  2. If the extra resolves wrong, install the SDK directly: pip install nvidia-riva-client
  3. Verify the interpreter can see it: python -c "import riva.client; print(riva.client.__file__)" — run this with the exact interpreter/venv your app uses
  4. For Docker deployments, add the extra to the image's requirements and rebuild rather than relying on the base litellm image
  5. If install succeeds but import still fails, check for a conflicting local file/directory named riva/ shadowing the package

Example fix

# before
litellm.transcription(model="riva/nvidia/parakeet", file=audio_file)  # NvidiaRivaException

# after (install once, then call)
# pip install 'litellm[stt-nvidia-riva]'
resp = litellm.transcription(model="riva/nvidia/parakeet", file=audio_file)
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

riva_available = importlib.util.find_spec("riva.client") is not None
if not riva_available:
    raise RuntimeError("Install first: pip install 'litellm[stt-nvidia-riva]'")

resp = litellm.transcription(model="riva/nvidia/parakeet", file=audio_file)

Prevention

When it happens

Trigger: Calling litellm.transcription() (or acompletion-style routing) with model="riva/..." (or any NVIDIA Riva provider model) in an environment where `import riva.client` fails. The error is raised from _import_riva() at the first transcription call, not at litellm import time.

Common situations: Installed plain `litellm` instead of `litellm[stt-nvidia-riva]`; using a deployment image (Docker, Lambda, serverless) that strips optional extras; wrong virtualenv/interpreter selected (package installed in another env); Python version incompatible with nvidia-riva-client wheels.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/677278ef54e35b68. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/nvidia_riva/audio_transcription/handler.py:404

                            "start_time_ms": int(getattr(word, "start_time", 0) or 0),
                            "end_time_ms": int(getattr(word, "end_time", 0) or 0),
                        }
                    )
                final_results.append({"transcript": transcript, "words": words})
        return final_results


def _import_riva():
    """
    Lazy import of ``riva.client`` and ``riva.client.proto.riva_asr_pb2``.

    We try the SDK first (preferred) and fall back to importing the proto
    module separately when the SDK packaging changes between versions.
    """
    try:
        import riva.client as riva_client
    except ImportError as e:
        raise NvidiaRivaException(status_code=500, message=_RIVA_INSTALL_HINT) from e

    riva_asr_module = riva_client
    if not hasattr(riva_asr_module, "RecognitionConfig"):
        try:
            from riva.client.proto import riva_asr_pb2

            riva_asr_module = riva_asr_pb2
        except ImportError as e:
            raise NvidiaRivaException(status_code=500, message=_RIVA_INSTALL_HINT) from e

    return riva_client, riva_asr_module

View on GitHub (pinned to 77b7c6c40c)