This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Mac : fail to launch Python 3.8
Type: Stage: resolved
Components: Installation, macOS Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Sebastien Foo, methane, ned.deily, ronaldoussoren, vstinner
Priority: normal Keywords:

Created on 2020-01-20 15:57 by Sebastien Foo, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (8)
msg360322 - (view) Author: Sebastien Foo (Sebastien Foo) Date: 2020-01-20 15:57
Hello,
I am facing an issue with python on mac and there is not much information that I can find to fix it.
When I installed the latest cli for Azure (brew upgrade azure-cli) it installed python 3.8
And then the az cli failed and running the python 3.8 failed too with the following error.
 
/usr/local/Cellar/python@3.8/3.8.1/Frameworks/Python.framework/Versions/3.8/bin/python3.8
Fatal Python error: config_get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed
Python runtime state: preinitialized
 
I have tried to reinstall python and the azure cli without success.

Any help would be much appreciated.
msg360354 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-01-21 06:01
Try `locale` command.  What is shown?
msg360359 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-21 07:50
Can you try to dump your environment variables? Try maybe the "env" command.

At least, I would need: LC_ALL, LC_CTYPE and LANG.
msg360364 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-01-21 08:29
An additional question: what version of macOS are you using?
msg360376 - (view) Author: Sebastien Foo (Sebastien Foo) Date: 2020-01-21 09:55
thanks averyone to help me
here are the values you are expecting

locale
LANG="en_US"
LC_COLLATE="en_US"
LC_CTYPE="en_US"
LC_MESSAGES="en_US"
LC_MONETARY="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_ALL=

doing env I get this (no LC_ALL )
LC_TERMINAL_VERSION=3.3.7
ITERM_PROFILE=zsh
XPC_FLAGS=0x0
LANG=en_US
SHELL=/usr/local/bin/zsh
TERM_PROGRAM_VERSION=3.3.7
TERM_PROGRAM=iTerm.app
LC_TERMINAL=iTerm2
LC_CTYPE=en_US

And for the last question I am using Catalina 10.15.2
msg360377 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2020-01-21 10:00
> doing env I get this (no LC_ALL )
[snip]
> LC_CTYPE=en_US

This is wrong setting.  Find where this environment variable is set and remove it.
msg360387 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-01-21 11:18
The other locale related settings are off as well, the default system locale ends with ".UTF-8".
msg360453 - (view) Author: Sebastien Foo (Sebastien Foo) Date: 2020-01-22 09:04
Thanks a lot for you help, my issue is solved.
My ~/.zshrc was having a LANG env var set to
     
LANG=en_US

I just commented out this line and everything works fine.
I don't know why this was set like that.

Thanks again for your time you can close this ticket.
History
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83578
2020-01-22 12:46:34methanesetstatus: open -> closed
resolution: not a bug
stage: resolved
2020-01-22 09:04:31Sebastien Foosetmessages: + msg360453
2020-01-21 11:18:06ronaldoussorensetmessages: + msg360387
2020-01-21 10:00:06methanesetmessages: + msg360377
2020-01-21 09:55:51Sebastien Foosetmessages: + msg360376
2020-01-21 08:29:04ronaldoussorensetmessages: + msg360364
2020-01-21 07:50:37vstinnersetmessages: + msg360359
2020-01-21 06:01:09methanesetnosy: + methane
messages: + msg360354
2020-01-20 16:01:04vstinnersetnosy: + vstinner
2020-01-20 15:58:50xtreaksetnosy: + ronaldoussoren, ned.deily
components: + macOS
2020-01-20 15:57:36Sebastien Foocreate