NGC API Key is invalid. Please check and try again

When executing the command-
bash jarvis_init.sh, It is failing with

Logging into NGC docker registry if necessary…
NGC API Key is invalid. Please check and try again.

turing enabled machine
Steps followed-

[root@xxx /]# wget -O ngccli_linux.zip https://ngc.nvidia.com/downloads/ngccli_linux.zip && unzip -o ngccli_linux.zip && chmod u+x ngc
–2021-07-20 15:36:50-- https://ngc.nvidia.com/downloads/ngccli_linux.zip
Resolving ngc.nvidia.com (ngc.nvidia.com)… 99.86.100.121, 99.86.100.9, 99.86.100.124, …
Connecting to ngc.nvidia.com (ngc.nvidia.com)|99.86.100.121|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 25118063 (24M) [application/zip]
Saving to: ‘ngccli_linux.zip’

100%[===========================================================================================================>] 25,118,063 24.7MB/s in 1.0s

2021-07-20 15:36:51 (24.7 MB/s) - ‘ngccli_linux.zip’ saved [25118063/25118063]

Archive: ngccli_linux.zip
inflating: ngc
extracting: ngc.md5
[root@xxx /]# echo “export PATH="$PATH:$(pwd)"” >> ~/.bash_profile && source ~/.bash_profile
[root@xxx /]# ngc config set
Enter API key [****************************************************************cWU4MDQ2YzZmbGM3YWZwdjZtNDNyMmZnYTU6MTExZGFiZjItNDFhMy00OTczLTljMTEtMWQ5ODJhMGE0MTY4
Enter CLI output format type [json]. Choices: [ascii, csv, json]: json
Enter org [rqtvygzvvbuc]. Choices: [‘evoshdo5ltlx’]: evoshdo5ltlx
Enter team [no-team]. Choices: [‘no-team’]: no-team
Enter ace [no-ace]. Choices: [‘no-ace’]: no-ace
[root@xxx /]# ngc registry resource download-version “nvidia/jarvis/jarvis_quickstart:1.2.1-beta”

{
“download_end”: “2021-07-20 15:41:10.080991”,
“download_start”: “2021-07-20 15:41:06.073153”,
“download_time”: “4s”,
“files_downloaded”: 28,
“local_path”: “/jjarvis_quickstart_v1.2.1-beta-1”,
“size_downloaded”: “261.8 KB”,
“status”: “Completed”,
“transfer_id”: “jarvis_quickstart_v1.2.1-beta”
}
[root@xxx /]#
[root@xxx /]# cd jarvis_quickstart_v1.2.1-beta
[root@xxx jarvis_quickstart_v1.2.1-beta]# bash jarvis_init.sh
Logging into NGC docker registry if necessary…
NGC API Key is invalid. Please check and try again.

Hi @antarab ,
Can you please validate if you still have the valid API key, or validate the following steps that to generate the API key, and let us know?

1. Log in to your enterprise account on the NGC website [http://ngc.nvidia.com.](http://ngc.nvidia.com/)
2. Click Setup from the side menu, then click API Key from the Setup page.
3. On the API Key page, click Generate API Key.
4. In response to the warning that your old API Key will become invalid, click CONTINUE to generate the key.
Your API key is displayed with examples of how to use it.

Thanks!

Hi @ AakankshaS
Antara and myself have tried generating new keys couple of times but same error is coming.
Is there direct way to check if key is valid or not ?

1 Like

Hi @ydangi , @antarab ,
Can you please check on the below points

  • Configure your CLI to use your API key with the ngc config set command.
  • Also check if docker key is update “sudo docker login nvcr.io” here as well. Please refer below section

Please let us know if this resolves the issue?

Thanks!

[root@xxx /]# md5sum -c ngc.md5
ngc: OK
[root@xxx /]# ngc config set
bash: ngc: command not found
[root@xxx/]# echo “export PATH="$PATH:$(pwd)"” >> ~/.bash_profile && source ~/.bash_profile
[root@xxx /]# ngc config set
Enter API key [***************************************************************** ***************MTY4]. Choices: [<VALID_APIKEY>, ‘no-apikey’]: << MY API KEY>>
Enter CLI output format type [json]. Choices: [ascii, csv, json]: json
Enter org [evoshdo5ltlx]. Choices: [‘evoshdo5ltlx’]: evoshdo5ltlx
Enter team [no-team]. Choices: [‘no-team’]: no-team
Enter ace [no-ace]. Choices: [‘no-ace’]: no-ace
[root@XXX /]# docker login nvcr.io
Authenticating with existing credentials…
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
docker login | Docker Documentation

Login Succeeded
[root@xxx /]# ^C
[root@xxx /]# ngc registry resource download-version “nvidia/jarvis/jarvis_quickstart:1.2.1-beta”
{
“download_end”: “2021-07-23 00:37:24.398698”,
“download_start”: “2021-07-23 00:37:19.387191”,
“download_time”: “5s”,
“files_downloaded”: 28,
“local_path”: “/jjarvis_quickstart_v1.2.1-beta-1”,
“size_downloaded”: “261.8 KB”,
“status”: “Completed”,
“transfer_id”: “jarvis_quickstart_v1.2.1-beta”
}
[root@xxx /]# cd jarvis_quickstart_v1.2.1-beta
[root@xxx jarvis_quickstart_v1.2.1-beta]# bash jarvis_init.sh
Logging into NGC docker registry if necessary…
NGC API Key is invalid. Please check and try again.

Above the steps, I am not sure where exactly is it failing? docker login nvcr.io SUCCEEDS.
can this be issue with the machine?

1 Like

Do you have an NGC_API_KEY variable set in your environment that is possibly invalid? If yes, that takes precedence over the key pulled from the NGC configuration file. The command that is failing is echo $NGC_API_KEY | docker login -u '$oauthtoken' --password-stdin nvcr.io

where $NGC_API_KEY either comes from your environment or is loaded from the ngc configuration file.

1 Like

Have verified there is no environment variable set on this machine with name as NGC_API_KEY

Hi @ydangi
Could you please try setting NGC_API_KEY as an env variable with your API key and retry the deployment?

Thanks

Please change this line in jarvis_init.sh and jarvis_start_client.sh

        ngc_key=$(cat $HOME/.ngc/config | grep apikey | awk '{print $3}')

to:

        ngc_key=$(cat $HOME/.ngc/config | grep -m 1 -G "^\s*apikey\s*=.*" | sed 's/^\s*apikey\s*=\s*//g')

This will be fixed starting in Riva v1.5.0 due out later this month. Thanks for your patience while we debugged this isue.

2 Likes

Hi @any command for ngc cli through API key generate [automate generate]

we are having the same issue, and would appreciate assistance.

the docker login succeeds, and we had no environment variable set.

have tried setting the NGC_API_KEY env variable, and got the following:

NGC_API_KEY is a deprecated environment variable. Please use NGC_CLI_API_KEY instead.

so we set NGC_CLI_API_KEY instead (after unsetting the deprecated variable), and it got seemingly ignored, as it still asked us for a key input:

Enter API key [no-apikey]. Choices: [<VALID_APIKEY>, 'no-apikey']: 

after entering our key, we are still getting the same error:

Invalid API key for NGC service location [https://api.ngc.nvidia.com]. Please try again.

the key which I am attempting to use has the permissions for both “Secrets Manager” and for the “NGC Catalog” (the only two available options to me), it has not expired yet, and I am the “Org Owner.”

the ngc cli version we are using is NGC CLI 3.4.1.

please inform me if there is any further information we may give that can assist in solving this issue.

regards,
hiroto

Hi Hiroto,
Can you report a Bug with support? We can then have a closer look into your NGC account permissions.

Having the same issue with new generated API key and authorizing the key to access NGC catalog, public API endpoints, Private Registry and Secret Manager. Am I missing any additional steps? NGC CLI version 2.16.0

Fixed after upgrading the NGC CLI client to the latest version (dl from Nvidia website)

1 Like

Thanks for letting us know you were able to resolve this @gmichel1.

Sophie

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.