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

Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build #77323

Closed
zopyx mannequin opened this issue Mar 26, 2018 · 2 comments
Labels
build The build process and cross-build topic-installation

Comments

@zopyx
Copy link
Mannequin

zopyx mannequin commented Mar 26, 2018

BPO 33142
Nosy @zopyx, @ned-deily

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2018-03-28.05:56:16.916>
created_at = <Date 2018-03-26.08:52:29.398>
labels = ['build', 'expert-installation']
title = 'Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build'
updated_at = <Date 2018-03-28.05:56:16.907>
user = 'https://github.com/zopyx'

bugs.python.org fields:

activity = <Date 2018-03-28.05:56:16.907>
actor = 'ned.deily'
assignee = 'none'
closed = True
closed_date = <Date 2018-03-28.05:56:16.916>
closer = 'ned.deily'
components = ['Installation']
creation = <Date 2018-03-26.08:52:29.398>
creator = 'ajung'
dependencies = []
files = []
hgrepos = []
issue_num = 33142
keywords = []
message_count = 2.0
messages = ['314442', '314563']
nosy_count = 2.0
nosy_names = ['ajung', 'ned.deily']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue33142'
versions = ['Python 3.6']

@zopyx
Copy link
Mannequin Author

zopyx mannequin commented Mar 26, 2018

Unable to build Python 3.6.4 from sources on a fresh Debian system:

@plone /tmp/Python-3.6.4 $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE
-DGITVERSION=""LC_ALL=C ""
-DGITTAG=""LC_ALL=C ""
-DGITBRANCH=""LC_ALL=C ""
-o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
rm -f libpython3.6m.a
ar rc libpython3.6m.a Modules/getbuildinfo.o
ar rc libpython3.6m.a Parser/acceler.o Parser/grammar1.o Parser/listnode.o Parser/node.o Parser/parser.o Parser/bitset.o Parser/metagrammar.o Parser/firstsets.o Parser/grammar.o Parser/pgen.o Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
ar rc libpython3.6m.a Objects/abstract.o Objects/accu.o Objects/boolobject.o Objects/bytes_methods.o Objects/bytearrayobject.o Objects/bytesobject.o Objects/cellobject.o Objects/classobject.o Objects/codeobject.o Objects/complexobject.o Objects/descrobject.o Objects/enumobject.o Objects/exceptions.o Objects/genobject.o Objects/fileobject.o Objects/floatobject.o Objects/frameobject.o Objects/funcobject.o Objects/iterobject.o Objects/listobject.o Objects/longobject.o Objects/dictobject.o Objects/odictobject.o Objects/memoryobject.o Objects/methodobject.o Objects/moduleobject.o Objects/namespaceobject.o Objects/object.o Objects/obmalloc.o Objects/capsule.o Objects/rangeobject.o Objects/setobject.o Objects/sliceobject.o Objects/structseq.o Objects/tupleobject.o Objects/typeobject.o Objects/unicodeobject.o Objects/unicodectype.o Objects/weakrefobject.o
ar rc libpython3.6m.a Python/_warnings.o Python/Python-ast.o Python/asdl.o Python/ast.o Python/bltinmodule.o Python/ceval.o Python/compile.o Python/codecs.o Python/dynamic_annotations.o Python/errors.o Python/frozenmain.o Python/future.o Python/getargs.o Python/getcompiler.o Python/getcopyright.o Python/getplatform.o Python/getversion.o Python/graminit.o Python/import.o Python/importdl.o Python/marshal.o Python/modsupport.o Python/mystrtoul.o Python/mysnprintf.o Python/peephole.o Python/pyarena.o Python/pyctype.o Python/pyfpe.o Python/pyhash.o Python/pylifecycle.o Python/pymath.o Python/pystate.o Python/pythonrun.o Python/pytime.o Python/random.o Python/structmember.o Python/symtable.o Python/sysmodule.o Python/traceback.o Python/getopt.o Python/pystrcmp.o Python/pystrtod.o Python/pystrhex.o Python/dtoa.o Python/formatter_unicode.o Python/fileutils.o Python/dynload_shlib.o Python/thread.o Python/frozen.o
ar rc libpython3.6m.a Modules/config.o Modules/getpath.o Modules/main.o Modules/gcmodule.o
ar rc libpython3.6m.a Modules/_threadmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/signalmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o
ranlib libpython3.6m.a
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lm
gcc -pthread -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.6m.a -lpthread -ldl -lutil -lm
./python -E -S -m sysconfig --generate-posix-vars ;
if test $? -ne 0 ; then
echo "generate-posix-vars failed" ;
rm -f ./pybuilddir.txt ;
exit 1 ;
fi
Could not find platform independent libraries
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to [:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f1757349440 (most recent call first):
Aborted
generate-posix-vars failed
Makefile:575: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1

@zopyx zopyx mannequin added the build The build process and cross-build label Mar 26, 2018
@zopyx zopyx mannequin changed the title Fatal Python error: Py_Initialize: Unable to get the locale encoding Fatal Python error: Py_Initialize: Unable to get the locale encoding on Debian/Python 3.6.4 source build Mar 26, 2018
@zopyx zopyx mannequin added the topic-installation label Mar 26, 2018
@ned-deily
Copy link
Member

Since python3.6 is regularly built with various Debian releases, this seems unlikely to be a problem in Python itself. Suggest you verify that no venv or virtualenv is in use or that PYTHON* environment variables are set or that no modifications provided by Debian are the cause. If you can reproduce with a stock Python 3.6.4 (3.6.5 shortly) tarball from python.org, please feel free to reopen and show the exact steps used to build, i.e. tar, configure, and make commands.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build topic-installation
Projects
None yet
Development

No branches or pull requests

1 participant