# Can't seem to get a smooth login process on my GCP VM

**URL:** <https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072>\
**Category:** W&B Help\
**Tags:** beginner-friendly\
**Created:** [March 11, 2024, 7:24am UTC](https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072 "2024-03-11T07:24:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abemdxb](https://avatars.discourse-cdn.com/v4/letter/a/41988e/32.png) [@abemdxb](https://community.wandb.ai/u/abemdxb)\
**Post date:** [March 11, 2024, 7:24am UTC](https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072/1 "2024-03-11T07:24:59Z")

</div>

Hi there I’m having a tough time getting simple logging up and running on my python scripts in my GCP VM.

I edit: tried to log into wandb once i SSH’d into my GCP VM but had to manually had to enter the API key because copy/paste doesn’t work in GCP VM CLI that popped up after i SSH’d in.

Therafter when I do “wandb status” i see the following:  
Current Settings  
{  
“\_extra\_http\_headers”: null,  
“\_proxies”: null,  
“api\_key”: null,  
“base\_url”: “[https://api.wandb.ai](https://api.wandb.ai)”,  
“entity”: null,  
“git\_remote”: “origin”,  
“ignore\_globs”: ,  
“project”: null,  
“root\_dir”: null,  
“section”: “default”  
}

It seems like it didn’t login? I suspect it has to do with manually having to type this stuff in and making errors- any chance someone can walk me through how to set wandb up in a GCP VM properly ?

the content of the netrc file is login user and the password so relogin didn’t work either.

if you guys have a workaround happy to hear it.

---

<div class="post-metadata">

**Author:** ![uma-wandb](https://avatars.discourse-cdn.com/v4/letter/u/b77776/32.png) [@uma-wandb](https://community.wandb.ai/u/uma-wandb)\
**Post date:** [March 13, 2024, 4:00pm UTC](https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072/2 "2024-03-13T16:00:25Z")

</div>

hey @abemdxb,

]To avoid having to log in manually each time, you can set your `WANDB_API_KEY` as an environment variable. This way, `wandb` can authenticate automatically without prompting for the key.

Here’s how you can set up your environment variable for `wandb`:

1. **Find your API key** : Log in to your [Weights & Biases account](https://wandb.ai/settings), and you’ll find your API key there.
2. **Set the environment variable** : You can add the following line to your `~/.bashrc` or `~/.bash_profile` file to set the `WANDB_API_KEY` environment variable:

```auto
export WANDB_API_KEY='your_api_key_here'

```

Replace `your_api_key_here` with the actual API key you obtained from the W&B settings page.  
3. **Source your profile** : After adding the line to your `~/.bashrc` or `~/.bash_profile`, run the following command to apply the changes:

```auto
source ~/.bashrc

```

Or if you added it to `~/.bash_profile`:

```auto
source ~/.bash_profile

```

1. **Verify the setup** : To verify that the environment variable is set correctly, you can echo it in your terminal:

```auto
echo $WANDB_API_KEY

```

This should print out your API key.  
5. **Use `wandb` in your scripts** : Now, when you run your Python scripts that use `wandb`, it should automatically authenticate using the API key set in the environment variable, and you won’t need to log in manually.

Here’s an example of how you might use `wandb` in your script:

```auto
import wandb

# Initialize a new run
wandb.init(project="my_project")

# Log some metrics
for i in range(10):
    wandb.log({"metric": i})

```

By setting the `WANDB_API_KEY` environment variable, `wandb` will authenticate using that key, and you should not be prompted to log in again, even when starting new sessions or using `tmux`.

---

<div class="post-metadata">

**Author:** ![uma-wandb](https://avatars.discourse-cdn.com/v4/letter/u/b77776/32.png) [@uma-wandb](https://community.wandb.ai/u/uma-wandb)\
**Post date:** [March 15, 2024, 5:51pm UTC](https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072/3 "2024-03-15T17:51:06Z")

</div>

Hi Abraham, 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!

---

<div class="post-metadata">

**Author:** ![phamanhquanbill](https://avatars.discourse-cdn.com/v4/letter/p/bc8723/32.png) [@phamanhquanbill](https://community.wandb.ai/u/phamanhquanbill)\
**Post date:** [January 31, 2025, 7:02pm UTC](https://community.wandb.ai/t/cant-seem-to-get-a-smooth-login-process-on-my-gcp-vm/6072/4 "2025-01-31T19:02:39Z")

</div>

Hi. I tried both ways and it didnt work. It still shows everything null for me. Any suggestions?  
wandb status  
Current Settings  
{  
“\_extra\_http\_headers”: null,  
“\_proxies”: null,  
“api\_key”: null,  
“base\_url”: “[https://api.wandb.ai](https://api.wandb.ai)”,  
“entity”: null,  
“git\_remote”: “origin”,  
“ignore\_globs”: ,  
“project”: null,  
“root\_dir”: null,  
“section”: “default”
