question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

8.1.1 locale.Error: unsupported locale setting in the Docker container

See original GitHub issue
  • Pip version: 8.1.1
  • Python version: 2.7.6
  • Operating System: ubuntu:14.04 in the Docker container

Description:

Traceback after upgrading pip from to 8.1.0 to 8.1.1 when LC_* environment variables are empty.

What I’ve run:

(env) root@cccf5e39dacc:/opt/project# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX

(env) root@cccf5e39dacc:/opt/project# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
(env) root@cccf5e39dacc:/opt/project# env | grep LC_

(env) root@cccf5e39dacc:/opt/project# pip install pip==8.1.0
Traceback (most recent call last):
  File "/opt/project/env/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/opt/project/env/local/lib/python2.7/site-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/opt/project/env/lib/python2.7/locale.py", line 579, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

(env) root@cccf5e39dacc:/opt/project# LC_ALL=C pip install pip==8.1.0
  Downloading pip-8.1.0-py2.py3-none-any.whl (1.2MB)

UPD. I’ve added this lines into the my Dockerfile to fix locale settings:

# Set the locale
RUN locale-gen en_US.UTF-8  
ENV LANG en_US.UTF-8  
ENV LANGUAGE en_US:en  
ENV LC_ALL en_US.UTF-8  

but traceback still looks like a regression in the pip ))

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:10
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
wichertcommented, Apr 14, 2016

Can we please get a pip release with this fix?

1reaction
fdemmercommented, Apr 1, 2016

definitely not a docker issue. eg also causing trouble in fresh ubuntu images used with vagrant when locale is not configured on initial provisioning run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python based Dockerfile throws locale.Error: unsupported ...
What I would do for Debian based docker image: ... and then in python: import locale locale.setlocale(locale.LC_ALL,'ru_RU.UTF-8').
Read more >
Locale.Error with centos 7 based docker - General Discussions
I am new to docker and would appreciate if someone can help me get rid of this error while building the docker image....
Read more >
Python locale error: unsupported locale setting
This works with other locales like fr or nl as well. I'm using Ubuntu 11.04. ... perl: warning: Setting locale failed. ... are...
Read more >
How to fix locale.Error: unsupported locale setting in Python
The first two commands set the LC_ALL and LC_CTYPE environment variables, then the third one commits the changes to the system. After running ......
Read more >
解决pip install时unsupported locale setting错误 - IT范儿
pip install locale.Error unsupported locale setting. 今天在安装 docker-compose 时,使用 pip install 命令出现了下面这个错误: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found