Can't Enter Client Token in Anaconda Prompt

Hello, I’m using the huggingface-cli login command in my Anaconda 3 Prompt, and it displays the HUGGINGFACE banner and asks for “Token:”, which I have from Hugging Face – The AI community building the future.. But then it won’t let me paste it or enter it manually. I hit the keys on my keyboard and nothing happens. When I press enter, I get this:

Traceback (most recent call last):
File “C:\Users\Desktop\anaconda3\lib\runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\Desktop\anaconda3\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\Desktop\anaconda3\Scripts\huggingface-cli.exe_main
.py", line 7, in
File “C:\Users\Desktop\anaconda3\lib\site-packages\huggingface_hub\commands\huggingface_cli.py”, line 41, in main
service.run()
File “C:\Users\Desktop\anaconda3\lib\site-packages\huggingface_hub\commands\user.py”, line 176, in run
_login(self._api, token=token)
File “C:\Users\Desktop\anaconda3\lib\site-packages\huggingface_hub\commands\user.py”, line 343, in _login
token, name = hf_api._validate_or_retrieve_token(token)
File “C:\Users\Desktop\anaconda3\lib\site-packages\huggingface_hub\hf_api.py”, line 691, in _validate_or_retrieve_token
raise ValueError(“Invalid token passed!”)
ValueError: Invalid token passed!

I don’t know what’s causing this, I was hoping someone here could help me figure it out. Thank you in advance for your help.

2 Likes

I’m having the same issue, I’ve tried through anaconda as well as raw admin cmd. I’m able to paste the api everywhere else except in the prompt for some reason.

Hey so I figured it out. You can paste the token when prompted, and then press enter. You won’t actually see the token pasted, but it is there, and it should work. Hope that helps.

No it doesn’t work, I get invalid token passed as response.

1 Like

I’m in the same boat with you Moo. I’ve tried and it still comes up with invalid token.

1 Like

Same issue here. I see the token prompt, but it ignores any inputs and copy-paste. Simply keeps the space blank.

1 Like

Same issue here and tried your suggestion, but does not help.

I did a quick & dirty fix. The command in file user.py that doe not do its job properly is getpass()

For some reason the prompt sometimes clears the clipboard copied text.
In anaconda you can paste by right-clicking in the field. Discovered this by accident.
So just copy the key, right-click in the text field and press enter. The text won’t show.

1 Like