Sample Header Ad - 728x90

failed to get the Python codec of the filesystem encoding after Ubuntu upgrade

0 votes
1 answer
4461 views
After upgrading to Ubuntu 23.04, my Python installation does not work anymore. Running Poetry gives the following :
bash
➜  ~ poetry
Could not find platform independent libraries 
Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.platlibdir = 'lib'
  sys.executable = '/home/guillaume/.local/share/pypoetry/venv/bin/python'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python310.zip',
    '/usr/lib/python3.10',
    '/usr/lib/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 0x00007ff0fb4b1040 (most recent call first):
Running python itself does work :
bash
➜  ~ python3
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
I tried : - Reinstalling Python - unsetting PYTHONHOME and PYTHONPATH How can I fix my Python setup ?
Asked by uiguig (63 rep)
Apr 20, 2023, 06:37 PM
Last activity: Jul 20, 2025, 02:04 PM