Not able to start or run bench in ubuntu linux

I have installed all requirements and bench but still when I run it it returns a message wit an error

Traceback (most recent call last):
File “/usr/local/lib/python3.10/dist-packages/git/init.py”, line 83, in
refresh()
File “/usr/local/lib/python3.10/dist-packages/git/init.py”, line 73, in refresh
if not Git.refresh(path=path):
File “/usr/local/lib/python3.10/dist-packages/git/cmd.py”, line 287, 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
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- 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

Example:
export GIT_PYTHON_REFRESH=quiet

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 5, in
from bench.cli import cli
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 14, in
from bench.bench import Bench
File “/usr/local/lib/python3.10/dist-packages/bench/bench.py”, line 36, in
from bench.utils.app import get_current_version
File “/usr/local/lib/python3.10/dist-packages/bench/utils/app.py”, line 17, in
from bench.app import get_repo_dir
File “/usr/local/lib/python3.10/dist-packages/bench/app.py”, line 17, in
from git import Repo
File “/usr/local/lib/python3.10/dist-packages/git/init.py”, line 85, in
raise ImportError(‘Failed to initialize: {0}’.format(exc))
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- 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

Example:
export GIT_PYTHON_REFRESH=quiet

Can somebody please tell me what is the problem is and how to solve it.

Hi.
I got the same error following the guide on installing ERPNext manually on Ubuntu 22 and I solved it.
The problem was: at some point of the tutorial, I ended up working under the home directory of the Ubuntu root user, which did not have the git executable set in the path.
The solution was: cd /home/[frappe-user]. Replace [frappe-user] with the user you created to install ERPNext.
Let’s know if this worked for you. Otherwise, there should be an other solution.

1 Like