Msm Python ImportError: Bad git executable

On my Mark 1, I periodically do a manual sudo apt full-upgrade followed by msm update. Today, the only Debian package was ca-certificates, but then the msm update yielded:

$ msm update
Traceback (most recent call last):
  File "/opt/venvs/mycroft-core/bin/msm", line 11, in <module>
    load_entry_point('msm==0.5.16', 'console_scripts', 'msm')()
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/", line 2700, in load_entry_point
    return ep.load()
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/", line 2318, in load
    return self.resolve()
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/pkg_resources/", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/", line 22, in <module>
    from .exceptions import *
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/msm/", line 25, in <module>
    from git import GitError
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/git/", line 82, in <module>
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/git/", line 73, in refresh
    if not Git.refresh(path=path):
  File "/opt/venvs/mycroft-core/lib/python3.4/site-packages/git/", line 290, in refresh
    raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
    - be included in your $PATH
    - explicitly set via git.refresh()

All git commands will error until this is rectified.

This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
    - quiet|q|silence|s|none|n|0: for no warning or exception
    - warn|w|warning|1: for a printed warning
    - error|e|raise|r|2: for a raised exception

    export GIT_PYTHON_REFRESH=quiet

For what it’s worth, git appears to be alive and kicking:

$ # (from my home directory, which isn't a git repo)
$ git status
fatal: Not a git repository (or any of the parent directories): .git
$ which git

Well. Whatever it was, a reboot fixed it.

As to the message I saw, that was from a freshly plugged in Mark 1. (We do not keep the beastie running 24/7 and so it is frequently shut down via sudo shutdown -h now and then unplugged.) So the error was after

  1. plugging in the Mark 1
  2. ssh’ing into it
  3. sudo apt update
  4. sudo apt full-upgrade
  5. msm update

Nothing else was done. (I point it out only because the glitch may be something preventable.)

Interesting, thanks for the info @ubuntourist. I certainly haven’t seen this one before.
Glad to hear that a reboot fixed it.