sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
1
0
Entering edit mode
5.2 years ago
kspata ▴ 90

Hi All,

I am running a perl script which integrates several tools like fastqc, bwa, and samtools to call variants. Recently, while calling this perl script I am getting error message as follows:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US.utf8",
    LC_ALL = "en_US.utf8",
    LC_TYPE = "en_US.utf8",
    LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

I have tried to resolve this error by setting /etc/environment to

LANGUAGE = "en_US.utf8",
        LC_ALL = "en_US.utf8",
        LC_TYPE = "en_US.utf8",
        LANG = "en_US.utf8"

but i still get this error and the pipeline is not running.

Except for bwa-index the other tools can not run individually through command line with this warning. I am using centos release 6.9 and gcc version

ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

Has anyone encountered this error? and how can I resolve this??

Thanks in advance !!

perl bash bwa • 12k views
ADD COMMENT
0
Entering edit mode

What do you get when you run locale?

Can you also tell us what Linux distribution (version numbers etc) you're running? (output of uname -a would probably suffice).

ADD REPLY
0
Entering edit mode
locale

Output:

locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

locale -a | grep "en_US"

Output:

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
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8

uname -a

Linux ngs.com 2.6.32-696.18.7.el6.x86_64 #1 SMP Thu Jan 4 17:31:22 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ADD REPLY
0
Entering edit mode

I'm not sure if this is the specific fix, but I think your method of setting them may be incorrect. I don't believe you need commas after them.

Try setting your user locale only rather than manipulating a system wide file like /etc/environment

Add the following to your relevant ~/.bashrc or equivalent file:

export LC_ALL="en_US.utf8"

This will set it each time you login. You could test whether it works by running that command at the prompt and retrying the installation, but the change may not stick next time you log in if you don't add it to one of your dotfiles.

ADD REPLY
0
Entering edit mode

Hi Joe,

There are no commas in the etc environment file.

I am still getting the same error, even with the above command

 export LC_ALL="en_US.utf8"

fastqc PhiX_S1_R1_001_val_1.sickle.fq.gz -t 16

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US.utf8",
        LC_ALL = "en_US.utf8",
        LC_TYPE = "en_US.utf8",
        LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
ADD REPLY
0
Entering edit mode

Are you connected via SSH to this system or is it your local machine?

ADD REPLY
0
Entering edit mode

I believe am connected via ssh. Although I am not sure how to check it.

The top command output

18149 callie_  20   0  104m 4108 1084 S  8.3  0.0   4:53.61 sshd

The who i am output

callie pts/0        Sep 16 14:13 mb02-002.com)
ADD REPLY
0
Entering edit mode

did you connect to a remote server with the ssh command?

Does the command echo "$SSH_CLIENT" return anything other than a blank line?

ADD REPLY
0
Entering edit mode

It does not return a blank line. It returns an ip address.

192.168.2.130 51954 22
ADD REPLY
0
Entering edit mode

Ok yep, you're on a server - are you connecting from a Mac?

Have you explored the answers here?

ADD REPLY
0
Entering edit mode
5.2 years ago
Joe 21k

You could try the following:

Set the locale settings and the locale-gen tool:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
locale-gen en_US.UTF-8

If that fails, try setting the locales to LC_ALL=C perl. If this succeeds it will likely be due to having your local machine (the server client) running incompatible locale settings, and then pushing these over the ssh connection. That is what this StackOverflow answer is suggesting. If you can correct things server-side without having to mess with your ssh connection that would be preferable though I think.

ADD COMMENT

Login before adding your answer.

Traffic: 1996 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6