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.

3 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.

2 Likes

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()

1 Like

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

How do I fix this issue as I would like to be able login and use the model’s??

2 Likes

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?

Im having the same issue I just cant enter the token or anything

that worked!!! TY

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)

2 Likes

This worked. Thank you.

yeah!! Thank you very much I was struggling at that point and now my toker is valid, have a good one

You can open python in the prompt and use huggingface_hub.login

1 Like

python prompt is a winner…don’t forget the import

import huggingface_hub
huggingface_hub.login()

I did in VSCODE. the problem is that the prompt does NOT SHOW the token. What i did (WINDOWS):

  1. copy and paste your token
  2. run the cli huggingface-cli login
  3. click in the blinking cursor and then select the token written before and right-click twice
(enviroment\.conda) C:\My\project\path\> token123
>>> 'token123' is not recognized as an internal or external command,
operable program or batch file.
(enviroment\.conda) C:\My\project\path\> huggingface-cli login
>>>
    _|    _|  _|    _|    _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|_|_|_|    _|_|      _|_|_|  _|_|_|_|
    _|    _|  _|    _|  _|        _|          _|    _|_|    _|  _|            _|        _|    _|  _|        _|
    _|_|_|_|  _|    _|  _|  _|_|  _|  _|_|    _|    _|  _|  _|  _|  _|_|      _|_|_|    _|_|_|_|  _|        _|_|_|
    _|    _|  _|    _|  _|    _|  _|    _|    _|    _|    _|_|  _|    _|      _|        _|    _|  _|        _|
    _|    _|    _|_|      _|_|_|    _|_|_|  _|_|_|  _|      _|    _|_|_|      _|        _|    _|    _|_|_|  _|_|_|_|

    To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token can be pasted using 'Right-Click'.
Token: | (blinking cursor)
  1. press ENTER and follow the instructions :grin:
1 Like