JanDeDobbeleer/oh-my-posh · warning

no python executable found

Error message

no python executable found

What it means

Raised by the python segment's pyenv tooling path: it looks up the absolute path of python (then python3) via the environment's CommandPath, and if neither resolves on PATH it cannot determine any Python version, so it fails with this error.

Source

Thrown at src/segments/python.go:179

			log.Debugf("virtual env name %s is invalid", name)
			return false
		}
	}

	return true
}

func (p *Python) pyenvVersion() (string, error) {
	// Use `pyenv root` instead of $PYENV_ROOT?
	// Is our Python executable at $PYENV_ROOT/bin/python ?
	// Should p.env expose command paths?
	cmdPath := p.env.CommandPath(pythonToolName)
	if cmdPath == "" {
		cmdPath = p.env.CommandPath(python3ToolName)
	}

	if cmdPath == "" {
		return "", errors.New("no python executable found")
	}

	pyEnvRoot := p.env.Getenv("PYENV_ROOT")
	if pyEnvRoot == "" || !strings.HasPrefix(cmdPath, pyEnvRoot) {
		return "", fmt.Errorf("executable at %s is not a pyenv shim", cmdPath)
	}

	// pyenv version-name will return current version or virtualenv
	cmdOutput, err := p.env.RunCommand("pyenv", "version-name")
	if err != nil {
		return "", err
	}

	versionString, _, found := strings.Cut(cmdOutput, ":")
	if !found || versionString == "" {
		return "", errors.New("no pyenv version-name found")
	}

View on GitHub (pinned to 0976794618)

Solutions

  1. Install Python (or a pyenv-managed version: pyenv install 3.x && pyenv global 3.x).
  2. Ensure python/python3 are on PATH in the shell that launches oh-my-posh (check PATH in .zshrc/.bashrc/profile).
  3. If you do not want pyenv handling, set the tooling option to skip "pyenv" and rely on other executables.
  4. Verify with `which python3` (or `where.exe python3` on Windows) in the same shell context.

Example fix

// before (PATH missing python)
export PATH="$HOME/bin:$PATH"
// after
export PATH="$PYENV_ROOT/bin:$PYENV_ROOT/shims:$HOME/bin:$PATH"
# and: pyenv global 3.12.1
Defensive patterns

Strategy: validation

Validate before calling

if ! command -v python3 >/dev/null 2>&1 && ! command -v python >/dev/null 2>&1; then
  echo "python/python3 not on PATH; install Python or fix PATH before enabling the segment"
fi

Try / catch

version, err := p.pyenvVersion()
if err != nil {
  if err.Error() == "no python executable found" {
    return "" // no Python installed — hide the segment quietly
  }
  return "", err
}

Prevention

When it happens

Trigger: The pyenv tool entry runs (it is first in the default tooling order) but no python/python3 binary exists on PATH — Python not installed, not added to PATH, or running in an environment (container, CI, minimal shell) without it.

Common situations: Fresh machine with pyenv installed but no Python version installed through it, PATH not updated in the shell spawning oh-my-posh (e.g. GUI-launched terminals), Windows without Python from the Store, or stripped-down Docker images.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/ebddfebfc05b5f4d. Report an issue: GitHub.