Failed to detect the name of this notebook, you can set it manually with the WANDB_NOTEBOOK_NAME env

In Visual Studio Code, first I encounted issues logging into wandb. I’ve tried specifying the entity as ‘myusername’, but it hasn’t resolved the problem. I’ve also confirmed that I’m using the latest version of wandb. My project folder is located on the Desktop.

import os

os.environ["WANDB_API_KEY"] = 'API_KEY'
!wandb login API_KEY

When I tried to initialize wandb (wandb.init()), I’m got the following error:

Changes to your `wandb` environment variables will be ignored because your `wandb` session has already started. For more information on how to modify your settings with `wandb.init()` arguments, please refer to [the W&B docs](https://wandb.me/wandb-init).
wandb: ERROR Error while calling W&B API: user is not logged in (<Response [401]>)

Then I decided to run it on terminal insisted of jupyter notebook cell but I got this error
Failed to detect the name of this notebook, you can set it manually with the WANDB_NOTEBOOK_NAME environment variable to enable code saving.

Any suggestions on how to resolve this?"

Hi @sara-k , thank you for reaching out and sorry to hear you are experiencing this.

In the Notebook could you try replacing

!wandb login API_KEY

with

wandb.login(key=os.environ["WANDB_API_KEY"])

and let me know if you can log runs successfully?

Alternatively, what is the output if you run wandb login directly in your terminal ?(without the API_KEY)

Hi @sara-k , I wanted to follow up on this request. Please let us know if we can be of further assistance or if your issue has been resolved.

Hi @sara-k , since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!