Skip to content

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

Open
@loboere

Description

@loboere

Sometimes when I execute a cell this error appears, I must restart the execution environment to eliminate the error.


NotImplementedError Traceback (most recent call last)
in
----> 1 get_ipython().system('pip install ffmpeg-python')

2 frames
/usr/local/lib/python3.8/dist-packages/google/colab/_system_commands.py in _run_command(cmd, clear_streamed_output)
161 locale_encoding = locale.getpreferredencoding()
162 if locale_encoding != _ENCODING:
--> 163 raise NotImplementedError(
164 'A UTF-8 locale is required. Got {}'.format(locale_encoding))
165

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

Activity

metrizable

metrizable commented on Feb 15, 2023

@metrizable
Contributor

@loboere Thanks for reporting the issue and thanks for using Colab. Can you provide a minimal reproducible notebook?

mlp2501

mlp2501 commented on Feb 26, 2023

@mlp2501

I got the same error .... any solution to this yet?

dracifer

dracifer commented on Feb 26, 2023

@dracifer

the commands triggered this error for me

!pip install youtube-dl
!youtube-dl https://www.youtube.com/watch?v=ll8TgCZ0plk -f 22 -o video.mp4
!ffmpeg -i video.mp4 -t 00:00:06 -c:v copy video-clip.mp4
karray

karray commented on Feb 27, 2023

@karray

I faced the same exception in pyannote.

I solved it by overriding locale.getpreferredencoding:

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

Here is a notebook with the workaround.

Update: While many people have found this workaround helpful, it is important to note that it should be regarded as a temporary solution and not considered a permanent fix.

wahid028

wahid028 commented on Mar 2, 2023

@wahid028

@karray this solution works for me. Thanks a lot

cperry-goog

cperry-goog commented on Mar 2, 2023

@cperry-goog

Thanks!

Dannynis

Dannynis commented on Mar 10, 2023

@Dannynis

I also get this error randomly, If i have to guess its after alot of outputs that been written to the output screen

victormurcia

victormurcia commented on Mar 16, 2023

@victormurcia

@karray this worked for me as well! Thanks!

karray

karray commented on Mar 16, 2023

@karray

In my opinion, this issue shouldn't be closed yet. While the workaround offered may serve as a temporary solution, it doesn't actually address the underlying problem.

TheWizier

TheWizier commented on May 9, 2023

@TheWizier

I agree with @karray This is not fixed and should be reopened. Encountered it just now myself.

59 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    NotImplementedError: A UTF-8 locale is required. Got ANSI_X3.4-1968 · Issue #3409 · googlecolab/colabtools