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.
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.
I did a quick & dirty fix. The command in file user.py that doe not do its job properly is getpass()
I removed the function and replaced it by setting the token = “huggingfacesuppliedtoken”
This helped enough to get login successful. I do not recommend my solution - but as a quick fix it does work. getpass — Portable password input — Python 3.10.7 documentation
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.
login with admin and spent 30min trying this method with no success. I give up! I really want to use AI but this Broken login method is driving me mad! sorry for my out burst. is there any other way with out using adaconda or is this bug across the board?
Had this same problem, my clipboard was getting cleared after every attempt to login. also, i couldn’t see the text after pasting. Order of operations was
huggingface-cli login
(Copy token to clipboard)
right click to paste (trust that it pastes, it won’t show)
(hit ENTER)