Install & Compatibility
Where this runs
tested against v2.26.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 51.8MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 4.3s · import 0.000s · 47MB
51MB installed
● package 51MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ASRClient
✓ from riva.client import ASRClient
✗ from riva.client import ASRClient
This quickstart demonstrates how to set up the Riva client, connect to a Riva server, and perform a simple Automatic Speech Recognition (ASR) task on a local WAV file. Ensure the `RIVA_URI` environment variable is set to your Riva server's address (e.g., `localhost:50051`). The script creates a dummy audio file if one isn't present for demonstration.
import os
import riva.client
import time
import wave
# Configure Riva server connection
# Ensure RIVA_URI is set in your environment (e.g., 'localhost:50051' or a remote address)
# For authenticated connections, set RIVA_API_KEY if needed.
riva_uri = os.environ.get('RIVA_URI', 'localhost:50051')
# Simple WAV file for ASR (create a dummy one if not present)
dummy_audio_file = 'dummy_audio.wav'
if not os.path.exists(dummy_audio_file):
with wave.open(dummy_audio_file, 'wb') as wf:
wf.setnchannels(1)
wf.setsampwidth(2)
wf.setframerate(16000)
wf.writeframes(b'\x00' * 16000 * 2) # 1 second of silence
print(f"Created a dummy audio file: {dummy_audio_file}")
try:
# Establish authentication (if needed, otherwise Auth() is sufficient)
auth = riva.client.Auth(uri=riva_uri)
# Initialize ASR client
asr_client = riva.client.ASRClient(auth)
# Configure ASR recognition
config = riva.client.RecognitionConfig(
encoding=riva.client.AudioEncoding.LINEAR_PCM, # or FLAC, MULAW, etc.
sample_rate_hertz=16000,
language_code="en-US",
max_alternatives=1,
enable_automatic_punctuation=True,
)
# Perform ASR on a local audio file
print(f"Transcribing {dummy_audio_file} from Riva server at {riva_uri}...")
response = asr_client.recognize_file(dummy_audio_file, config)
# Print results
if response.results:
for result in response.results:
if result.alternatives:
print(f"Transcription: {result.alternatives[0].transcript}")
else:
print("No alternatives found for this segment.")
else:
print("No speech recognized in the audio.")
except Exception as e:
print(f"An error occurred: {e}")
print("Please ensure the Riva server is running and accessible at the specified RIVA_URI.")
Debug
Known issues
breakingThe `grpcio` dependency often requires specific versions to match the `nvidia-riva-client` version. Incompatible `grpcio` versions can lead to `ImportError` or `AttributeError` during runtime, particularly with protobuf definitions or gRPC channel initialization.fixAlways install `nvidia-riva-client` directly via pip; it will pull the correct `grpcio` version. If issues persist, verify the `grpcio` version manually (`pip show grpcio`) against the `nvidia-riva-client` PyPI dependencies. Upgrade `nvidia-riva-client` to the latest version to get the widest compatibility.
affects: Various versions prior to 2.25.1 (e.g., 2.17.0 pinned to 1.64.1, 2.18.0 updated to 1.67.1). The current client generally specifies a compatible range.
breakingThe NLP client APIs were deprecated and removed in Riva client versions starting from 2.15.0.fixMigrate any NLP tasks (e.g., intent recognition, named entity recognition) to the separate `nvidia-nemo-client` library or alternative NVIDIA NLP frameworks. Do not attempt to use `riva.client.NLPClient`.
affects: 2.15.0 and later
gotchaRiva client versions are generally designed to be compatible with a specific range of Riva server versions. Mismatched client and server versions can lead to unexpected errors, `gRPC UNAVAILABLE` status codes, or incorrect API behavior.fixAlways check the NVIDIA Riva documentation for the recommended client-server version compatibility matrix. It is generally best practice to keep the client and server versions as closely aligned as possible.
affects: All versions
gotchaAuthentication methods and metadata retrieval (e.g., `get_auth_metadata`) have seen updates across versions, which might break older authentication patterns.fixRefer to the latest NVIDIA Riva client documentation and examples for the current recommended authentication practices, especially when dealing with secure or token-based server deployments. Use the `riva.client.Auth` class and its methods as demonstrated in up-to-date quickstarts.
affects: Versions around 2.19.0 (where `get_auth_metadata` was updated) and potentially earlier.
Upgrade
Version history
2.26.0latest on PyPI · released May 28, 2026
Audit
Dependencies
grpciorequiredRequired for gRPC communication with the Riva server. The client specifies a compatible version range.