BerriAI/litellm · error · NvidiaRivaException

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

Error message

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

What it means

The Riva transcription path lazily imports the `riva.client` Python SDK (nvidia-riva-client) inside `_import_riva()`. If the package is absent, the ImportError is re-raised as NvidiaRivaException(500) with the install hint `pip install 'litellm[stt-nvidia-riva]'`. This is a local environment problem, not a Riva service problem — no network request has been attempted.

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 6c2dcb801b)

Solutions

  1. Install the optional dependency group: pip install 'litellm[stt-nvidia-riva]'.
  2. If that extra is unavailable in your litellm version, install the SDK directly: pip install nvidia-riva-client.
  3. Verify in the same interpreter that runs litellm: python -c "import riva.client; print(riva.client.__file__)".
  4. Rebuild/redeploy the container after adding the dependency so it is baked into the image.

Example fix

# before
pip install litellm
# ...transcription(model='riva/...') -> NvidiaRivaException 500

# after
pip install 'litellm[stt-nvidia-riva]'
python -c "import riva.client"  # sanity check
Defensive patterns

Strategy: validation

Validate before calling

import importlib.util

if importlib.util.find_spec('riva.client') is None:
    raise RuntimeError("nvidia-riva-client missing — run: pip install 'litellm[stt-nvidia-riva]'")

Type guard

def riva_sdk_available() -> bool:
    import importlib.util
    return importlib.util.find_spec('riva.client') is not None

Try / catch

from litellm.llms.nvidia_riva.common_utils import NvidiaRivaException

try:
    litellm.transcription(model='riva/...', audio_file=f, api_base=base)
except NvidiaRivaException as e:
    if 'not installed' in str(e):
        logger.error('environment misconfigured: install litellm[stt-nvidia-riva]')
        raise SystemExit(1)  # config error, do not retry

Prevention

When it happens

Trigger: Calling litellm.transcription with a `riva/...` model on an environment where `import riva.client` fails: the nvidia-riva-client package was never installed, was installed in a different virtualenv/interpreter than the one running litellm, or was uninstalled during an image slimming step.

Common situations: Using a minimal Docker image or lambda layer that omits the optional STT extra; a CI requirements file that pins litellm but not the [stt-nvidia-riva] extra; multiple pythons on the machine with the package installed under a different one; pip install succeeded but the deploy environment was rebuilt from a stale lockfile.

Related errors


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