{"record":{"id":"e1e228fe01edbf13","repo":"JanDeDobbeleer/oh-my-posh","slug":"executable-at-s-is-not-a-pyenv-shim","errorCode":null,"errorMessage":"executable at %s is not a pyenv shim","messagePattern":"executable at (.+?) is not a pyenv shim","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/segments/python.go","lineNumber":184,"sourceCode":"\treturn true\n}\n\nfunc (p *Python) pyenvVersion() (string, error) {\n\t// Use `pyenv root` instead of $PYENV_ROOT?\n\t// Is our Python executable at $PYENV_ROOT/bin/python ?\n\t// Should p.env expose command paths?\n\tcmdPath := p.env.CommandPath(pythonToolName)\n\tif cmdPath == \"\" {\n\t\tcmdPath = p.env.CommandPath(python3ToolName)\n\t}\n\n\tif cmdPath == \"\" {\n\t\treturn \"\", errors.New(\"no python executable found\")\n\t}\n\n\tpyEnvRoot := p.env.Getenv(\"PYENV_ROOT\")\n\tif pyEnvRoot == \"\" || !strings.HasPrefix(cmdPath, pyEnvRoot) {\n\t\treturn \"\", fmt.Errorf(\"executable at %s is not a pyenv shim\", cmdPath)\n\t}\n\n\t// pyenv version-name will return current version or virtualenv\n\tcmdOutput, err := p.env.RunCommand(\"pyenv\", \"version-name\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tversionString, _, found := strings.Cut(cmdOutput, \":\")\n\tif !found || versionString == \"\" {\n\t\treturn \"\", errors.New(\"no pyenv version-name found\")\n\t}\n\n\t// $PYENV_ROOT/versions + versionString (symlinks resolved) == $PYENV_ROOT/versions/(version)[/envs/(virtualenv)]\n\trealPath, err := p.env.ResolveSymlink(filepath.Join(pyEnvRoot, \"versions\", versionString))\n\tif err != nil {\n\t\treturn \"\", err\n\t}","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/segments/python.go#L166-L202","documentation":"The python segment supports pyenv-managed interpreters. pyenvVersion first locates the python/python3 executable and then verifies it lives under $PYENV_ROOT (a pyenv 'shim'). This error is thrown when a python executable exists on PATH but is not inside PYENV_ROOT — so the active python is not managed by pyenv and `pyenv version-name` would not correspond to it.","triggerScenarios":"PYENV_ROOT is unset, or the resolved CommandPath for python/python3 points outside PYENV_ROOT (e.g. /usr/bin/python3, a Homebrew python, or a manually activated venv) while the segment's version logic tries the pyenv path.","commonSituations":"pyenv installed but PATH shims not set up (or removed), python installed via system package manager shadowing pyenv shims, PYENV_ROOT customized but shims in the default ~/.pyenv/shims, or a virtualenv activated by another tool taking precedence on PATH.","solutions":["Ensure pyenv shims are on PATH: add `eval \"$(pyenv init -)\"` (and pyenv-virtualenv init) to your shell rc","Set PYENV_ROOT if pyenv is installed in a non-default location (e.g. export PYENV_ROOT=\"$HOME/.pyenv\") and add $PYENV_ROOT/shims to PATH","Run `which python` / `which python3` and confirm it resolves to $PYENV_ROOT/shims/python","If you don't use pyenv, the segment falls back to other version detection — check that your display_mode/version detection config matches your setup"],"exampleFix":"// before (~/.zshrc)\neval \"$(pyenv init --path)\"  # shims incomplete / PYENV_ROOT unset\n// after\nexport PYENV_ROOT=\"$HOME/.pyenv\"\ncase \"$PATH\" in *\"$PYENV_ROOT/shims\"*) ;; *) export PATH=\"$PYENV_ROOT/bin:$PYENV_ROOT/shims:$PATH\";; esac\neval \"$(pyenv init -)\"","handlingStrategy":"validation","validationCode":"[[ -n \"$PYENV_ROOT\" ]] && which python | grep -q \"$PYENV_ROOT\" && echo \"pyenv shims active\" || echo \"python not pyenv-managed\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set PYENV_ROOT explicitly in your shell rc and prepend $PYENV_ROOT/shims to PATH","Run `eval \"$(pyenv init -)\"` (and pyenv-virtualenv init) in interactive shells","Verify with `which python` that shims resolve before system/Homebrew pythons","If not using pyenv, don't expect pyenv-based version detection in the segment"],"tags":["go","python","pyenv","env-var","path"],"backgroundTag":"executable-not-managed-by-pyenv","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}