InstructLab: "ilab config init" command failing with git error

Solution Verified - Updated -

Issue

  • InstructLab: ilab config init command failing with git error
# ilab config init
Traceback (most recent call last):
  File "/root/instructLab/venv/lib64/python3.11/site-packages/git/__init__.py", line 296, in <module>
    refresh()
  File "/root/instructLab/venv/lib64/python3.11/site-packages/git/__init__.py", line 287, in refresh
    if not Git.refresh(path=path):
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/root/instructLab/venv/lib64/python3.11/site-packages/git/cmd.py", line 631, 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(<full-path-to-git-executable>)

All git commands will error until this is rectified.

This initial message 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|silent|none|n|0: for no message or exception
    - warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default)
    - error|e|exception|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/instructLab/venv/bin/ilab", line 5, in <module>
    from instructlab.lab import ilab
  File "/root/instructLab/venv/lib64/python3.11/site-packages/instructlab/lab.py", line 12, in <module>
    from instructlab import clickext
  File "/root/instructLab/venv/lib64/python3.11/site-packages/instructlab/clickext.py", line 20, in <module>
    from instructlab.configuration import DEFAULTS, BaseModel, get_dict, storage_dirs_exist
  File "/root/instructLab/venv/lib64/python3.11/site-packages/instructlab/configuration.py", line 42, in <module>
    from instructlab.utils import get_model_arch, use_legacy_pretraining_format
  File "/root/instructLab/venv/lib64/python3.11/site-packages/instructlab/utils.py", line 24, in <module>
    from git import Repo, exc
  File "/root/instructLab/venv/lib64/python3.11/site-packages/git/__init__.py", line 298, in <module>
    raise ImportError("Failed to initialize: {0}".format(_exc)) from _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(<full-path-to-git-executable>)

All git commands will error until this is rectified.

This initial message 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|silent|none|n|0: for no message or exception
    - warn|w|warning|log|l|1: for a warning message (logging level CRITICAL, displayed by default)
    - error|e|exception|raise|r|2: for a raised exception

Example:
    export GIT_PYTHON_REFRESH=quiet

Environment

  • InstructLab

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content