I'm new to mlflow and learning it from very beginning. I installed mlflow
package in python, and run the following code in spyder.
import os
from random import random, randint
from mlflow import log_metric, log_param, log_artifacts
if __name__ == "__main__":
print("Running mlflow_tracking.py")
log_param("param1", randint(0, 100))
log_metric("foo", random())
log_metric("foo", random() + 1)
log_metric("foo", random() + 2)
if not os.path.exists("outputs"):
os.makedirs("outputs")
with open("outputs/test.txt", "w") as f:
f.write("hello world!")
log_artifacts("outputs")
This code should be standard and I run it for test. What makes me confused is that git-related error appears. No git connect is set up and no git file is called. Why is there such an error. By the way, I have ..\AppData\Local\GitHubDesktop\bin
in path (is github
the same as git
here).
WARNING mlflow.utils.git_utils: Failed to import Git (the Git executable is probably not on your PATH), so Git SHA is not available. Error: 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
Running mlflow_tracking.py
I searched the following link to fix this error by setting os.environ["GIT_PYTHON_REFRESH"] = "quiet"
.
git executable not found in python
Could anyone explain why it's this way and help to fix this issue. Thanks in advance.