Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

huggingface-cli login on Google Colab results in UTF-8 locale error #2588

Open
ayyucedemirbas opened this issue Oct 2, 2024 · 2 comments
Open

Comments

@ayyucedemirbas
Copy link

Hi,

I encountered an issue while trying to login to Hugging Face using the !huggingface-cli login command on Google Colab. The command results in the following error:

NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968

I managed to solve the issue by adding the following code before the login command:

import locale
locale.getpreferredencoding = lambda: "UTF-8"

This solution works temporarily, but I believe the underlying issue should be addressed on the HuggingFace Hub.

Thank you for your time and attention.

@Wauplin
Copy link
Contributor

Wauplin commented Oct 3, 2024

Hi @ayyucedemirbas to login in a colab notebook, it is recommended to either set a Colab secret called HF_TOKEN (that you will be able to share between notebooks) or to run

from huggingface_hub import login

login()

in the first cell.

Could you try that and let us know how it goes?

@Wauplin
Copy link
Contributor

Wauplin commented Oct 3, 2024

About the UTF8 issue, can you copy-paste the full error with stacktrace please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants