Python Forum
ModuleNotFoundError: No module named ‘CommandNotFound’
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ModuleNotFoundError: No module named ‘CommandNotFound’
#1
Whenever I try

Quote:sudo apt update

I got:

Quote:Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
ModuleNotFoundError: No module named 'CommandNotFound'
Reading package lists... Done
E: 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


Any suggestions?
Pei
Reply
#2
command is:
sudo apt-get update
Reply
#3
(Feb-22-2020, 03:34 AM)Larz60+ Wrote: command is:
sudo apt-get update

Well, yes... I'm using Ubuntu 18.04.3, in this version:
Quote:sudo apt update
is the same as
Quote:sudo apt-get update
Reply
#4
Looking at your previous Thread.
This likely mess up most the PATH to original Python version.
If looking at Package: command-not-found
So here see that dependency is the default python3 version,this will be the same for the Debian family Ubuntu,Mint...ect.
Look here for possible solution's.

As a advice you should not at all mess with default Python installation in Linux.
Using alias is safer than mess with export.
My advice is using pyenv Simple Python Version Management
Reply
#5
(Feb-22-2020, 10:05 AM)snippsat Wrote: My advice is using pyenv Simple Python Version Management

Quote:➜ ~ pyenv install -v 3.8.1
......
ERROR: Exception:
Traceback (most recent call last):
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 188, in main
status = self.run(options, args)
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 286, in run
with self._build_session(options) as session:
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 101, in _build_session
session = PipSession(
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/download.py", line 559, in __init__
self.headers["User-Agent"] = user_agent()
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_internal/download.py", line 144, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 677, in linux_distribution
self.version(),
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 737, in version
self.lsb_release_attr('release'),
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 899, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 552, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "/tmp/tmp6a9wsa3z/pip-19.2.3-py2.py3-none-any.whl/pip/_vendor/distro.py", line 1012, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/tmp/python-build.20200222120905.3660/Python-3.8.1/Lib/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/tmp/python-build.20200222120905.3660/Python-3.8.1/Lib/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' died with <Signals.SIGABRT: 6>.
Makefile:1186: recipe for target 'install' failed
make: *** [install] Error 2

BUILD FAILEDCould 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 0x00007f597cccd340 (most recent call first):
( using python-build 1.2.16-5-g7097f820)

Inspect or clean up the working tree at /tmp/python-build.20200222120905.3660
Results logged to /tmp/python-build.20200222120905.3660.log

Last 10 log lines:
subprocess.CalledProcessError: Command '('lsb_release', '-a')' died with <Signals.SIGABRT: 6>.
Makefile:1186: recipe for target 'install' failed
make: *** [install] Error 2
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 0x00007f597cccd340 (most recent call first):
➜ ~

Failed to install Python3.8.1 under pyenv
Reply
#6
(Feb-22-2020, 08:13 PM)jiapei100 Wrote: ➜ ~ pyenv install -v 3.8.1
There is no -v when you install.
pyenv install 3.8.1
You use capital -V after to check version.
python -V
Python 3.8.1
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  no module named 'docx' when importing docx MaartenRo 1 853 Dec-31-2023, 11:21 AM
Last Post: deanhystad
  Problem with pymodbus - ModuleNotFoundError: No module named 'pymodbus.client.sync' stsxbel 2 23,626 Nov-02-2023, 08:20 AM
Last Post: South_east
  ModuleNotFoundError: No module named 'requests' Serg 18 2,522 Oct-29-2023, 11:33 PM
Last Post: Serg
  Resolving ImportError: No module named gdb (Python in C++) mandaxyz 3 1,421 Oct-04-2023, 02:43 PM
Last Post: mandaxyz
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,485 Aug-07-2023, 05:32 AM
Last Post: DPaul
  ModuleNotFoundError: No module named 'eyed3' Wimpy_Wellington 2 1,311 Jul-10-2023, 03:37 AM
Last Post: Wimpy_Wellington
  How to fix this error: ModuleNotFoundError: No module named 'notears' yaoyao22 2 1,020 Jul-09-2023, 11:24 AM
Last Post: yaoyao22
  Help with pyinstaller "No module named" korenron 9 8,903 Jun-15-2023, 12:20 PM
Last Post: snippsat
  Problem with Pyinstaller. No module named '_tkinter' tonynapoli2309 0 997 May-15-2023, 02:38 PM
Last Post: tonynapoli2309
  ModuleNotFoundError: No module named 'omsdk.sdkproto' donvito7 4 1,829 Oct-20-2022, 02:56 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020