{"id":7451,"library":"ngcsdk","title":"NVIDIA GPU Cloud SDK","description":"The NVIDIA GPU Cloud (NGC) SDK is a Python library that enables developers to integrate their applications and utilities with NVIDIA GPU Cloud. It provides programmatic access to NGC services, allowing users to manage resources, run jobs, and interact with the NGC catalog. The library is currently at version 4.17.0 and sees active development with frequent releases.","status":"active","version":"4.17.0","language":"en","source_language":"en","source_url":"https://ngc.nvidia.com/sdk","tags":["NVIDIA","GPU","Cloud","AI","ML","HPC","SDK","NGC"],"install":[{"cmd":"pip install ngcsdk","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required Python interpreter version for the SDK.","package":"python","version":">=3.10","optional":false}],"imports":[{"symbol":"Client","correct":"from ngcsdk import Client"}],"quickstart":{"code":"import os\nfrom ngcsdk import Client\n\n# Retrieve API key from environment variable for security and flexibility\nNGC_API_KEY = os.environ.get('NGC_API_KEY', 'YOUR_NGC_API_KEY_HERE') # Replace with your actual key or set env var\n\nif not NGC_API_KEY or NGC_API_KEY == 'YOUR_NGC_API_KEY_HERE':\n    print(\"Warning: NGC_API_KEY environment variable not set or placeholder used. Please provide a valid API key from ngc.nvidia.com/setup.\")\n    exit(1)\n\ntry:\n    # Initialize the NGC SDK client\n    clt = Client()\n\n    # Configure the client. This will set user settings for future operations.\n    # Replace 'my_org' and 'my_team' with your actual NGC organization and team names.\n    # 'ace_name' can often be 'no-ace' or a specific ACE if your organization uses one.\n    clt.configure(api_key=NGC_API_KEY, org_name='nvidia', team_name='no-team', ace_name='no-ace')\n    print(\"Successfully configured NGC SDK client.\")\n\n    # Verify current configuration\n    current_config = clt.current_config()\n    print(\"Current NGC configuration:\")\n    for item in current_config:\n        print(f\"  {item['key']}: {item['value']} (Source: {item['source']})\")\n\n    # Example: List available ACEs (Accelerated Compute Environments)\n    # This assumes 'basecommand' is available and configured.\n    # Note: Access to specific commands like 'aces' depends on your NGC permissions and setup.\n    # try:\n    #     aces_info = clt.basecommand.aces.list()\n    #     print(\"\\nAvailable ACEs:\")\n    #     for ace in aces_info.values():\n    #         print(f\"  - {ace['name']}\")\n    # except AttributeError:\n    #     print(\"\\nCould not access 'aces' command. Check permissions or client setup.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize and configure the `ngcsdk` client using an API key. It's crucial to obtain an API key from the NVIDIA NGC website (ngc.nvidia.com/setup) and ideally store it as an environment variable (`NGC_API_KEY`) for secure access. The `configure` method persists these settings for subsequent SDK operations."},"warnings":[{"fix":"Use `os.environ.get('NGC_API_KEY')` to retrieve API keys. Avoid hardcoding sensitive credentials. Ensure the API key is generated and saved securely from `ngc.nvidia.com/setup`.","message":"The `ngcsdk` client configuration (`clt.configure()`) writes settings to user files. Ensure API keys are handled securely and not hardcoded. For automated environments, prefer using environment variables.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify your network connection, DNS settings, and proxy configurations. Ensure `https://authn.nvidia.com` is reachable. Environment variables like `HTTPS_PROXY` might need to be set if behind a corporate proxy.","message":"Network connectivity issues, corporate proxies, or incorrect DNS configurations can lead to 'URL not reachable' or 'Name or service not known' errors during SDK operations, especially during client configuration or authentication with NGC services.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin your `ngcsdk` version in `requirements.txt` (e.g., `ngcsdk==4.17.0`) to ensure consistent behavior across deployments. Review release notes for new versions to understand potential impacts.","message":"While not explicitly called out as a breaking change for the SDK itself, the NGC ecosystem frequently updates. NVIDIA recommends using specific version tags for NGC containers in production rather than `:latest`. This best practice extends to the SDK; consider pinning `ngcsdk` versions to avoid unexpected behavior changes.","severity":"gotcha","affected_versions":"All versions, especially with future updates"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Check your internet connectivity. If you are behind a corporate proxy, set the `HTTPS_PROXY` and `HTTP_PROXY` environment variables to your proxy server address (e.g., `export HTTPS_PROXY=\"http://your.proxy.com:port\"`).","cause":"The NGC authentication endpoint is unreachable, often due to network restrictions, firewall rules, or incorrect proxy settings.","error":"Url: https://authn.nvidia.com/token?service=ngc& is not reachable."},{"fix":"Verify your DNS configuration. Ensure your system can resolve external hostnames. This can also be caused by proxy issues; try the `HTTPS_PROXY` fix mentioned above if applicable.","cause":"This error indicates a DNS resolution failure, meaning the system cannot resolve the hostname of NGC services to an IP address.","error":"socket.gaierror: [Errno -2] Name or service not known"},{"fix":"For invalid wheel errors, ensure you are installing `ngcsdk` directly via `pip install ngcsdk` rather than from a manually downloaded wheel, and that your Python environment is healthy. For dependency conflicts, try installing `ngcsdk` in a clean virtual environment first. If conflicts persist with other libraries, inspect dependency trees (`pip show ngcsdk` and `pipdeptree`) to identify the conflicting packages and adjust versions accordingly.","cause":"These can indicate issues with the downloaded wheel file (e.g., corrupted, incompatible architecture) or, more commonly, dependency conflicts arising from other installed libraries (e.g., `langchain-core` requiring a specific version of `packaging` that conflicts with `ngcsdk`'s transitive dependencies).","error":"ERROR: Wheel 'ngcsdk' located at ... is invalid. OR  packaging.requirements.InvalidRequirement: Invalid specifier: '~=0.1.52'"}]}