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.

Author vstinner
Recipients Sabuj Pattanayek, ergun, lauer@wpi.edu, paul.moore, skrah, steve.dower, tim.golden, vstinner, zach.ware
Date 2020-04-09.15:57:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586447845.34.0.341721710014.issue27054@roundup.psfhosted.org>
In-reply-to
Content
> I continually get the error
> "Fatal Python error: Py_Initialize: unable to load the file system codec
> ImportError: No module named 'encodings'"

FYI I enhanced this error in Python 3.8 to "dump the Python path configuration". Example:

$ PYTHONHOME=x PYTHONPATH=y python3.8
Python path configuration:
  PYTHONHOME = 'x'
  PYTHONPATH = 'y'
  program name = 'python3.8'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3.8'
  sys.base_prefix = 'x'
  sys.base_exec_prefix = 'x'
  sys.executable = '/usr/bin/python3.8'
  sys.prefix = 'x'
  sys.exec_prefix = 'x'
  sys.path = [
    'y',
    'x/lib64/python38.zip',
    'x/lib64/python3.8',
    'x/lib64/python3.8/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f50aaad8740 (most recent call first):
<no Python frame>

It should be easier for users to understand their mistake.

In general, leave PYTHONHOME empty/unset unless you understand very well what you are doing ;-)
History
Date User Action Args
2020-04-09 15:57:25vstinnersetrecipients: + vstinner, paul.moore, tim.golden, skrah, zach.ware, steve.dower, lauer@wpi.edu, Sabuj Pattanayek, ergun
2020-04-09 15:57:25vstinnersetmessageid: <1586447845.34.0.341721710014.issue27054@roundup.psfhosted.org>
2020-04-09 15:57:25vstinnerlinkissue27054 messages
2020-04-09 15:57:25vstinnercreate