# Jupiter notebook unable to login

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fjupiter-notebook-unable-to-login%2F23539%3E%5C
**Category:** Beginners\
**Created:** [September 23, 2022, 3:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fjupiter-notebook-unable-to-login%2F23539 "2022-09-23T15:06:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterB123A](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/peterb123a/32/11792_2.png) [@PeterB123A](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPeterB123A)%5C
**Post date:** [September 23, 2022, 3:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fjupiter-notebook-unable-to-login%2F23539%2F1 "2022-09-23T15:06:13Z")

</div>

Based upon samples here the first part of my code runs fine no errors :

```auto
API_TOKEN = "hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" #(I retrieved a key)
model = "gpt2"
model = "CompVis/stable-diffusion-v1-4"
import json
import requests
API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2F"+model
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def query(payload):
    data = json.dumps(payload)
    response = requests.request("POST", API_URL, headers=headers, data=data)
    return json.loads(response.content.decode("utf-8"))
data = query("Can you please let us know more details about your ")

```

However the second part returns an error :

```auto
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"

pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
pipe = pipe.to(device)
prompt = "a photo of an astronaut riding a horse on mars"
with autocast("cuda"):
    image = pipe(prompt, guidance_scale=7.5).images[0]  
 
image.save("astronaut_rides_horse.png")

```

The error raised is :

```auto
OSError Traceback (most recent call last)
/tmp/ipykernel_84/3423739988.py in <module>
      7 
      8 
----> 9 pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token=True)
     10 pipe = pipe.to(device)
     11 

/opt/conda/lib/python3.8/site-packages/diffusers/pipeline_utils.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    286 # use snapshot download here to get it working from from_pretrained
    287 if not os.path.isdir(pretrained_model_name_or_path):
--> 288 cached_folder = snapshot_download(
    289 pretrained_model_name_or_path,
    290 cache_dir=cache_dir,

/opt/conda/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py in inner_f(*args, **kwargs)
     91 message += "\n\n" + custom_message
     92 warnings.warn(message, FutureWarning)
---> 93 return f(*args, **kwargs)
     94 
     95 return inner_f

/opt/conda/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py in snapshot_download(repo_id, revision, repo_type, cache_dir, library_name, library_version, user_agent, proxies, etag_timeout, resume_download, use_auth_token, local_files_only, allow_regex, ignore_regex, allow_patterns, ignore_patterns)
    113 token = HfFolder.get_token()
    114 if token is None:
--> 115 raise EnvironmentError(
    116 "You specified use_auth_token=True, but a Hugging Face token was not"
    117 " found."

OSError: You specified use_auth_token=True, but a Hugging Face token was not found.

```

I’m running a Docker container (with cuda support) ubuntu inside windows 11.  
I retrieved a Read token, but i seam unable to make use of it.  
Any help would be great.

---

<div class="post-metadata">

**Author:** ![PeterB123A](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/peterb123a/32/11792_2.png) [@PeterB123A](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FPeterB123A)%5C
**Post date:** [September 24, 2022, 3:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fjupiter-notebook-unable-to-login%2F23539%2F2 "2022-09-24T15:02:59Z")

</div>

> [@PeterB123A](#):
>
> `a Hugging Face token was not found`

it worked after i added in a new yupiter code cell the following

```auto
from huggingface_hub import notebook_login
notebook_login()

```
