I seem to have done some damage to my WSL2 environment by playing around with python versions. Is there any way to fix this? I'm trying to perform an apt-get update
but I get the following errors:
➜ ~ sudo apt-get updateHit:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InReleaseHit:2 http://archive.ubuntu.com/ubuntu focal InReleaseHit:3 http://archive.ubuntu.com/ubuntu focal-updates InReleaseHit:4 http://archive.ubuntu.com/ubuntu focal-backports InReleaseHit:5 https://packages.cloud.google.com/apt cloud-sdk InReleaseHit:6 http://security.ubuntu.com/ubuntu focal-security InReleaseTraceback (most recent call last): File "/usr/lib/cnf-update-db", line 8, in <module> from CommandNotFound.db.creator import DbCreatorModuleNotFoundError: No module named 'CommandNotFound'Error in sys.excepthook:Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module> from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 32, in <module> import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 12, in <module> import os, glob, subprocess, os.path, time, pwd, sys, requests_unixsocketModuleNotFoundError: No module named 'requests_unixsocket'Original exception was:Traceback (most recent call last): File "/usr/lib/cnf-update-db", line 8, in <module> from CommandNotFound.db.creator import DbCreatorModuleNotFoundError: No module named 'CommandNotFound'Reading package lists... DoneE: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'E: Sub-process returned an error code
Here are some elements that could be helpful to fix the situation :
Python installed versions
➜ ~ ls -al /usr/bin/python*lrwxrwxrwx 1 root root 24 Oct 13 2020 /usr/bin/python -> /etc/alternatives/pythonlrwxrwxrwx 1 root root 9 Mar 13 2020 /usr/bin/python2 -> python2.7-rwxr-xr-x 1 root root 3674216 Mar 8 14:02 /usr/bin/python2.7lrwxrwxrwx 1 root root 9 Mar 13 2020 /usr/bin/python3 -> python3.8lrwxrwxrwx 1 root root 16 Mar 13 2020 /usr/bin/python3-config -> python3.8-config-rwxr-xr-x 2 root root 5203064 May 3 04:51 /usr/bin/python3.6lrwxrwxrwx 1 root root 33 May 3 04:51 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config-rwxr-xr-x 2 root root 5203064 May 3 04:51 /usr/bin/python3.6mlrwxrwxrwx 1 root root 34 May 3 04:51 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config-rwxr-xr-x 1 root root 5486384 Jan 27 16:41 /usr/bin/python3.8lrwxrwxrwx 1 root root 33 Jan 27 16:41 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
Distro details
➜ ~ cat /etc/*releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=20.04DISTRIB_CODENAME=focalDISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"NAME="Ubuntu"VERSION="20.04.2 LTS (Focal Fossa)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 20.04.2 LTS"VERSION_ID="20.04"HOME_URL="https://www.ubuntu.com/"SUPPORT_URL="https://help.ubuntu.com/"BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"VERSION_CODENAME=focalUBUNTU_CODENAME=focal
EDIT:
Trying to run sudo apt-get install python3-all
yields a ModuleNotFoundError: No module named 'debian'