0

I've managed to get into a situation where I have a circular dependency between lsb-release and python3. When I try to sudo apt install python3 --reinstall I get the following (just pasting the key lines)

(Reading database ... 470097 files and directories currently installed.)
Preparing to unpack .../python3_3.6.7-1~18.04_amd64.deb ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

[~] lsb_release
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fa905a81740 (most recent call first):
Aborted (core dumped)

Clearly my lsb_release is broken. But if I run sudo apt-get install lsb-release I get

dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of lsb-release:
 lsb-release depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

So I can't fix my python3 installation without fixing lsb-release, and vice versa.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
GTK
  • 103
  • 3

1 Answers1

1

You can fix your Python installation without fixing lsb_release. Your Python installation needs other Python packages to be reinstalled; at least

sudo apt install --reinstall libpython3.6-minimal

and perhaps more. To reinstall all the packages, run

sudo apt install --reinstall libpython3.6{,-minimal,-stdlib} python3.6{,-minimal}

You should then find that lsb_release works fine.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164