BerriAI/litellm · error · ImportError

cryptography package is required for OCI authentication…

Error message

cryptography package is required for OCI authentication. Please install it with: pip install cryptography

What it means

Error "cryptography package is required for OCI authentication. Please install it with: pip install cryptography" thrown in BerriAI/litellm.

Solutions

  1. Install the cryptography package: pip install cryptography.

When it happens

Trigger: Thrown at litellm/llms/oci/common_utils.py:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at litellm/llms/oci/common_utils.py:35

    from cryptography.hazmat.primitives.asymmetric import padding, rsa

    _CRYPTOGRAPHY_AVAILABLE = True
except ImportError:
    _CRYPTOGRAPHY_AVAILABLE = False

try:
    from litellm._version import version as _litellm_version
except ImportError:
    _litellm_version = "0.0.0"


# OCI GenAI REST API version — stable since service launch, unlikely to change
OCI_API_VERSION: Final = "20231130"


def _require_cryptography() -> None:
    if not _CRYPTOGRAPHY_AVAILABLE:
        raise ImportError(
            "cryptography package is required for OCI authentication. Please install it with: pip install cryptography"
        )


class OCIError(BaseLLMException):
    def __init__(
        self,
        status_code: int,
        message: str,
        headers: httpx.Headers | None = None,
    ):
        super().__init__(
            status_code=status_code,
            message=message,
            headers=headers,
        )

View on GitHub (pinned to 77b7c6c40c)