huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
2.01k stars 531 forks source link

notebook_login() fails for jupyter notebook #2417

Open HarryLyness opened 2 months ago

HarryLyness commented 2 months ago

Describe the bug

Logging on with google colabs works fine. When attempting to log in to huggingface on jupyter notebook

image

I get the following error.

[Errno 13] Permission denied:

I have also tried alternative methods, e.g.

from huggingface_hub import login

login(token=os.environ.get("HF_TOKEN"))
[Errno 13] Permission denied: 'C:\\Users\\harry\\.cache\\huggingface\\token'

Reproduction

from huggingface_hub import login

login(token=os.environ.get("HF_TOKEN"))

Logs

[Errno 13] Permission denied: 'C:\\Users\\harry\\.cache\\huggingface\\token'

System info

{'huggingface_hub version': '0.24.1',
 'Platform': 'Windows-10-10.0.22621-SP0',
 'Python version': '3.11.5',
 'Running in iPython ?': 'Yes',
 'iPython shell': 'ZMQInteractiveShell',
 'Running in notebook ?': 'Yes',
 'Running in Google Colab ?': 'No',
 'Token path ?': 'C:\\Users\\harry\\.cache\\huggingface\\token',
 'Has saved token ?': True,
 'Who am I ?': 'diffusepanda4',
 'FastAI': 'N/A',
 'Tensorflow': 'N/A',
 'Torch': '2.1.0',
 'Jinja2': '3.1.2',
 'Graphviz': 'N/A',
 'keras': 'N/A',
 'Pydot': 'N/A',
 'Pillow': '9.4.0',
 'hf_transfer': 'N/A',
 'gradio': 'N/A',
 'tensorboard': 'N/A',
 'numpy': '1.24.3',
 'pydantic': '1.10.8',
 'aiohttp': '3.8.5',
 'ENDPOINT': 'https://huggingface.co',
 'HF_HUB_CACHE': 'C:\\Users\\harry\\.cache\\huggingface\\hub',
 'HF_ASSETS_CACHE': 'C:\\Users\\harry\\.cache\\huggingface\\assets',
 'HF_TOKEN_PATH': 'C:\\Users\\harry\\.cache\\huggingface\\token',
 'HF_HUB_OFFLINE': False,
 'HF_HUB_DISABLE_TELEMETRY': False,
 'HF_HUB_DISABLE_PROGRESS_BARS': None,
 'HF_HUB_DISABLE_SYMLINKS_WARNING': False,
 'HF_HUB_DISABLE_EXPERIMENTAL_WARNING': False,
 'HF_HUB_DISABLE_IMPLICIT_TOKEN': False,
 'HF_HUB_ENABLE_HF_TRANSFER': False,
 'HF_HUB_ETAG_TIMEOUT': 10,
 'HF_HUB_DOWNLOAD_TIMEOUT': 10}
Wauplin commented 2 months ago

Hi @HarryLyness, I'm sorry for the inconvenience. It looks like the Python interpreter running the Jupyter notebook don't have permission to write into 'C:\\Users\\harry\\.cache\\huggingface\\token' file - which is not really a problem with huggingface_hub itself. This should not be the case if you run it from harry user. Could you check manually that you have the permission to do it? (for example with touch C:\\Users\\harry\\.cache\\huggingface\\token' on WSL).