0

After upgrading to Ubuntu 23.04, my Python installation does not work anymore.

Running Poetry gives the following :

➜  ~ poetry
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
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):
  <no Python frame>

Running python itself does work :

➜  ~ 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 ?

1 Answer 1

0

Answering my own question for future reference.

I overlooked the obvious. The issue had to do with Poetry. Reinstalling Poetry fixed the issue.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.