Skip to main content

NGC-SDK

The NVIDIA NGC software development kit to interact and develop Python utilities and applications to integrate with the NVIDIA GPU Cloud.

Prerequisites

Python version >= 3.9

Install from pypi

Install the package from pypi.org by running the following command:

pip install ngcsdk

This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.

Extras

Some features require additional dependencies, which are optional unless you need enhanced telemetry.

To install these extras, use:

pip install ngcsdk[telemetry]

After installing the SDK, the first step is to create and configure the client.

Creating and configuring NGC SDK client

To set the configuration, run the following functions.

Tip

This needs an API key. For information about generating an API key, refer to the setup, https://ngc.nvidia.com/setup.

from ngcsdk import Client

clt = Client()

clt.configure(api_key='****NkMQ', org_name='nvidia', team_name='no-team')
Validating configuration...
Successfully validated configuration.

clt.current_config()
[{'key': 'apikey', 'value': '****NkMQ', 'source': 'user settings'},
 {'key': 'format_type', 'value': 'ascii', 'source': 'user settings'},
 {'key': 'org', 'value': 'nvidia', 'source': 'user settings'},
 {'key': 'team', 'value': 'no-team', 'source': 'user settings'}]

Debugging

Configure debug logging using Python's logging utility.

import logging

from ngcsdk import Client

logger = logging.getLogger()

logger.setLevel(logging.DEBUG)

clt = Client()

model = clt.registry.model.info("nvidia/nemotron")
DEBUG:ngcbase.api.connection:Requesting URL (GET): https://api.stg.ngc.nvidia.com/v2/org/nvidia/model/nemotron
    payload: None
    params: None
DEBUG:ngcbase.api.authentication:Retrieving API Key Token from cache....
DEBUG:ngcbase.api.authentication:Token in use: ****hPWE
DEBUG:ngcbase.api.authentication:Expiration time of token: '2024-03-07 16:36:03.849188'
DEBUG:ngcbase.api.authentication:Fetched token from the cache. Expires 2024-03-07 16:36:03.849188
DEBUG:ngcbase.api.utils:Headers:
DEBUG:ngcbase.api.utils:{'Content-Type': 'application/json', ...}
DEBUG:ngcbase.api.connection:Response status: 200 - Reason: OK
DEBUG:ngcbase.api.connection:Time taken to process URL: https://api.stg.ngc.nvidia.com/v2/org/nvidia/model/nemotron: 0.34587s
DEBUG:ngcbase.api.connection:Response is: {"requestStatus":{"statusCode":"SUCCESS"}, ...}

For more information on how to configure logging, see Python's official tutorial on logging.

Output

Methods return either objects or JSON. Objects can be inspected and converted to a python dictionary or JSON format.

from ngcsdk import Client

clt = Client()

model = clt.registry.model.info("nvidia/nemotron")

help(model)
Help on Model in module ngccli.data.api.Model object:

class Model(builtins.object)
 |  Model(propDict=None)
 |
 |  Methods defined here:
 |
 |  __init__(self, propDict=None)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  isValid(self)
 |
 |  toDict(self)
 |
 |  toJSON(self, pretty=False)

model.toDict()
{'name': 'nvidia/nemotron', ...}

model.toJSON()
'{"name": "nvidia/nemotron", ...}

models = clt.registry.model.list()

help(models)
Help on chain object:

class chain(builtins.object)
 |  chain(*iterables) --> chain object
 |
 |  Return a chain object whose .__next__() method returns elements from the
 |  first iterable until it is exhausted, then elements from the next
 |  iterable, until all of the iterables are exhausted.
 |
 |  Methods defined here:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __next__(self, /)
 |      Implement next(self).

[model.name for model in models]
['nvidia/nemotron', ....]

Metadata

Release files for ngcsdk 4.37.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for ngcsdk 4.37.0
File Interpreter ABI Platform
ngcsdk-4.37.0-py3-none-any.whl Python 3 none any Details

Release files / ngcsdk-4.37.0-py3-none-any.whl

Download URL ngcsdk-4.37.0-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4918b907f8c06cf2ab20e8c4081bbc5f10dc44255c814d78d40c49965cb834fb
BLAKE2b-256 checksum
How to use checksums
9489178bd8a815b5d00efb363bf668f24430c2936f493aeca006fdd19d245c10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

4.37.0 This release

1 release file

4.36.6

1 release file

4.34.7

1 release file

4.21.0

1 release file

4.20.1

1 release file

4.20.0

1 release file

4.19.1

1 release file

4.18.0

1 release file

4.17.0

1 release file

4.16.0

1 release file

4.15.0

1 release file

4.14.0

1 release file

4.13.0

1 release file

4.12.0

1 release file

4.11.1

1 release file

4.11.0

1 release file

4.10.0

1 release file

4.9.17

1 release file

4.9.10

1 release file

4.8.2

1 release file

4.6.6

1 release file

4.5.2

1 release file

4.3.0

1 release file

3.169.4

1 release file

3.164.0

1 release file

3.158.1

1 release file

3.151.0

1 release file

3.148.1

1 release file

3.146.4

1 release file

3.146.2

1 release file

3.64.4

1 release file

3.64.3

1 release file

3.64.2

1 release file

3.64.1

1 release file

3.63.0

1 release file

3.62.0

1 release file

3.61.0

1 release file

3.60.2

1 release file

3.60.1

1 release file

3.60.0

1 release file

3.59.0

1 release file

3.58.0

1 release file

3.57.2

1 release file

3.57.1

1 release file

3.57.0

1 release file

3.56.0

1 release file

3.55.0

1 release file

3.54.0

1 release file

3.53.0

1 release file

3.52.0

1 release file

3.51.0

1 release file

3.50.0

1 release file

3.49.0

1 release file

3.48.0

1 release file

3.47.0

1 release file

3.46.0

1 release file

3.45.0

1 release file

3.44.0

1 release file

3.43.0

1 release file

3.42.0

1 release file

3.41.4

1 release file

3.41.3

1 release file

3.41.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page