{"record":{"id":"dab243d026630963","repo":"ScrapeGraphAI/Scrapegraph-ai","slug":"the-langchain-nvidia-ai-endpoints-module-is-not-in","errorCode":null,"errorMessage":"The langchain_nvidia_ai_endpoints module is not installed.\n              Please install it using `pip install langchain-nvidia-ai-endpoints`.","messagePattern":"The langchain_nvidia_ai_endpoints module is not installed\\.\n              Please install it using `pip install langchain-nvidia-ai-endpoints`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"scrapegraphai/models/nvidia.py","lineNumber":24,"sourceCode":"class Nvidia:\n    \"\"\"\n    A wrapper for the ChatNVIDIA class that provides default configuration\n    and could be extended with additional methods if needed.\n\n    Note: This class uses __new__ instead of __init__ because langchain_nvidia_ai_endpoints\n    is an optional dependency. We cannot inherit from ChatNVIDIA at class definition time\n    since the module may not be installed. The __new__ method allows us to lazily import\n    and return a ChatNVIDIA instance only when Nvidia() is instantiated.\n\n    Args:\n        llm_config (dict): Configuration parameters for the language model.\n    \"\"\"\n\n    def __new__(cls, **llm_config):\n        try:\n            from langchain_nvidia_ai_endpoints import ChatNVIDIA\n        except ImportError:\n            raise ImportError(\n                \"\"\"The langchain_nvidia_ai_endpoints module is not installed.\n                              Please install it using `pip install langchain-nvidia-ai-endpoints`.\"\"\"\n            )\n\n        if \"api_key\" in llm_config:\n            llm_config[\"nvidia_api_key\"] = llm_config.pop(\"api_key\")\n\n        return ChatNVIDIA(**llm_config)\n","sourceCodeStart":6,"sourceCodeEnd":33,"githubUrl":"https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/532dfffbf6ee823a6c9cf8cfedc24a93bf026780/scrapegraphai/models/nvidia.py#L6-L33","documentation":"Nvidia.__new__ lazily imports ChatNVIDIA from langchain_nvidia_ai_endpoints and converts the ImportError into this instructive error. The Nvidia wrapper in scrapegraphai/models/nvidia.py is instantiated when model_provider is 'nvidia', so the failure happens during _create_llm.","triggerScenarios":"config = {'llm': {'model_provider': 'nvidia', 'model': 'meta/llama-3.1-70b-instruct', 'api_key': ...}} without langchain-nvidia-ai-endpoints installed.","commonSituations":"Base install lacking the optional NVIDIA integration; new CI/container images; environments where the package was pruned or the langchain version makes the endpoint package uninstallable.","solutions":["pip install langchain-nvidia-ai-endpoints.","Ensure the installed version matches your langchain-core version (upgrade both together if needed).","Confirm with python -c 'from langchain_nvidia_ai_endpoints import ChatNVIDIA'."],"exampleFix":"# before\nconfig = {'llm': {'model_provider': 'nvidia', 'api_key': key}}\nSmartScraperGraph(prompt=..., config=config)  # ImportError\n\n# after\n# shell: pip install langchain-nvidia-ai-endpoints\nconfig = {'llm': {'model_provider': 'nvidia', 'api_key': key}}\nSmartScraperGraph(prompt=..., config=config)","handlingStrategy":"validation","validationCode":"if config['llm'].get('model_provider') == 'nvidia':\n    import importlib.util\n    if importlib.util.find_spec('langchain_nvidia_ai_endpoints') is None:\n        raise SystemExit('Run: pip install langchain-nvidia-ai-endpoints')","typeGuard":"def nvidia_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('langchain_nvidia_ai_endpoints') is not None","tryCatchPattern":"try:\n    graph = SmartScraperGraph(prompt=p, config=config)\nexcept ImportError as e:\n    if 'langchain_nvidia_ai_endpoints' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'langchain-nvidia-ai-endpoints'])\n        graph = SmartScraperGraph(prompt=p, config=config)\n    else:\n        raise","preventionTips":["Add langchain-nvidia-ai-endpoints to requirements when using the nvidia provider.","Probe optional integrations with find_spec before graph construction.","Keep langchain / endpoint-package versions in sync."],"tags":["missing-dependency","nvidia","llm","import-error"],"backgroundTag":"optional-dependency-not-installed","analyzedSha":"532dfffbf6ee823a6c9cf8cfedc24a93bf026780","analyzedAt":"2026-08-28T15:19:38.821Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}