I had several installations of python on my ubuntu 18.04 system and tried to uninstall all necessary ones and just properly reinstall python3.6
So i deleted all folders that were listed under whereis python
, probably that was a bad idea.
Now if I run sudo apt-get install python3.6
it returns
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.6 is already the newest version (3.6.5-3).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python3.6-minimal (3.6.5-3) ...
Could not find platform independent libraries <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 0x00007f814f83c740 (most recent call first):
Aborted
dpkg: error processing package python3.6-minimal (--configure):
installed python3.6-minimal package post-installation script subprocess returned error exit status 134
Setting up python-minimal (2.7.15~rc1-1) ...
/var/lib/dpkg/info/python-minimal.postinst: 4: /var/lib/dpkg/info/python-minimal.postinst: python2.7: not found
dpkg: error processing package python-minimal (--configure):
installed python-minimal package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of python3.6:
python3.6 depends on python3.6-minimal (= 3.6.5-3); however:
Package python3.6-minimal is not configured yet.
dpkg: error processing package python3.6 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3.6-dev:
python3.6-dev depends on python3.6 (= 3.6.5-3); however:
Package python3.6 is not configured yet.
dpkg: error processing package python3.6-dev (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3.6-minimal
python-minimal
python3.6
python3.6-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)
I then tried to update the minimal package with sudo apt-get install -f --reinstall python3.6-minimal
but that returns
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 4 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for python3.6-minimal:amd64
I'm not really an experienced linux user, so I'm quite stuck here. Does someone have an idea how I can fix my python installation?
apt-get purge --remove <package> && apt autoremove && apt autoclean
and install again your python – abu-ahmed al-khatiri Sep 08 '18 at 15:21<package>
would be what? Sorry I'm not really a Linux user... – po.pe Sep 08 '18 at 15:31purge
is failing withCould 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 local encoding ModuleNotFoundError: No module named 'encodings'
So same output as I listed in my question forsudo apt-get install pyhton3.6
– po.pe Sep 08 '18 at 15:46apt-get update && apt-get upgrade && dpkg --configure -a && sudo dpkg-configure python3.6
– abu-ahmed al-khatiri Sep 08 '18 at 15:51apt-get install python3.6-minimal
it somehow refers to python2.7. What does thatCould not find platform dependent/independent libraries
message mean? Is my Python not properly deleted or have I deleted files I should have not? – po.pe Sep 08 '18 at 17:02apt-get install --fix-broken
– abu-ahmed al-khatiri Sep 10 '18 at 07:51dpkg: error processing package python3.6 (--configure): dependency problems - leaving unconfigured
and the same forpython3.6-dev
– po.pe Sep 10 '18 at 13:40apt-get purge python* && apt-get autoclean && apt-get install python*
sir – abu-ahmed al-khatiri Sep 10 '18 at 13:47/usr/bin/python3
symlink was incorrectly set (I think because I was messing with pyenv or something) and so I had to relink it to/usr/bin/python3.9
, the system python version for Ubuntu 21.04. After that, it was still not configured correctly, so I ransudo apt install --reinstall python3.9
and then everything clicked back in place. – OzzyTheGiant May 21 '22 at 17:56