Search code examples
pythoncygwinpython-3.8

cygwin python installation: "Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding"


I'm trying to set up a new cygwin installation and install python through cygwin. I've done so, and the setup completed, but when I try to run python3.8 I get a fatal python error:

$ python3.8
Python path configuration:
  PYTHONHOME = 'C:\Users\cmhac\AppData\Local\Programs\Python\Python38'
  PYTHONPATH = 'C:\Users\cmhac\AppData\Local\Programs\Python\Python38'
  program name = 'python3.8'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3.8.exe'
  sys.base_prefix = 'C'
  sys.base_exec_prefix = '\\Users\\cmhac\\AppData\\Local\\Programs\\Python\\Python38'
  sys.executable = '/usr/bin/python3.8.exe'
  sys.prefix = 'C'
  sys.exec_prefix = '\\Users\\cmhac\\AppData\\Local\\Programs\\Python\\Python38'
  sys.path = [
    'C',
    '\\Users\\cmhac\\AppData\\Local\\Programs\\Python\\Python38',
    'C/lib/python38.zip',
    'C/lib/python3.8',
    '\\Users\\cmhac\\AppData\\Local\\Programs\\Python\\Python38/lib/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 0x0000000800000010 (most recent call first):
<no Python frame>

How do I even begin fixing this? The python38.exe file is there, and everything seems fine. Never had this error with any other python installation.


Solution

  • I saw this exact error: 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'

    If you set these two env variables to nil, the problem should disappear: set PYTHONHOME= set PYTHONPATH=