I was doing dist-upgrade to my system, but something didn't work as expected, and I also was running the upgrade while doing some other work.
Result python 3 got messed up and I can't run apt updates and cant upgrade the system
Error message:
dpkg: error processing package python3 (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Käsittelyssä tapahtui liian monta virhettä:
python3
E: Sub-process /usr/bin/dpkg returned an error code (1)
My commandline history:
276 sudo apt-get update && sudo apt-get dist-upgrade
277 sudo apt-get dist-upgrade
278 sudo apt autoremove
279 sudo apt-get dist-upgrade
280 man apt
281 man dist-upgrade
282 sudo do-release-upgrade
283 /usr/bin/python3
284 sudo do-release-upgrade
285 sudo rm /usr/bin/python
286 sudo ln -s /usr/bin/python2.7 /usr/bin/python
287 sudo do-release-upgrade
288 sudo ln -sf /usr/bin/python2.7 /usr/bin/python
289 sudo do-release-upgrade
290 sudo update-alternatives --remove-all python
291 sudo update-alternatives --remove-all python3
292 sudo ln -sf /usr/bin/python3.6 /usr/bin/python3
293 sudo do-release-upgrade
294 sudo apt-get install --reinstall python3
295 sudo do-release-upgrade
296 sudo dpkg --remove --force-remove-reinstreq --force-depends python3
297 sudo apt-get -f install
298 sudo do-release-upgrade
299 sudo apt-get update
300 sudo apt-get upgrade
301 sudo apt-get reinstall python3
302 man apt-get
303 sudo apt-get install python3 --reinstall
304 sudo ln -sf /usr/bin/python2.7 /usr/bin/python
305 sudo apt-get install python3 --reinstall
306 sudo do-release-upgrade
307 history
308 update-manager
309 sudo apt-get update && sudo apt-get upgrade
310 sudo apt-get install python3
311 sudo apt-get reinstall python3
312* sudo dpkg --remove --force-remove-reinstr
313 sudo dpkg --remove --force-remove-reinstreq python3 && sudo apt-get install python3
Now I do not remember anymore what I was actually doing, as this happened before my vacation, and now three weeks later I don't remember anymore what actually happened leading to this situation.
What should I do here?
pip
, and the version of a dependency changes. So the existing Python installation tends to run better without modifications. For development, scripters should use a virtual environment or a container. The Anaconda distro is another option.$ sudo python3 -m venv some_env_name
. – noobninja Dec 15 '19 at 22:37bash: /usr/lib/command-not-found: /usr/bin/python3:
– Ossi Viljakainen Dec 18 '19 at 14:12