pulumi/pulumi · error

evaluating python execution alias: %w

Error message

evaluating python execution alias: %w

What it means

During resolveWindowsExecutionAlias (the fallback that scans %LOCALAPPDATA%\Microsoft\WindowsApps for UWP execution aliases), os.Lstat on a candidate python executable returned an error that is NOT 'file not found'. The toolchain wraps it as 'evaluating python execution alias: %w'.

Source

Thrown at sdk/python/toolchain/pip.go:395

				e = "." + e
			}
			exts = append(exts, e)
		}
	} else {
		exts = append(exts, ".com", ".exe", ".bat", ".cmd")
	}

	path := os.Getenv("PATH")
	for _, dir := range filepath.SplitList(path) {
		if !strings.Contains(strings.ToLower(dir), filepath.Join("microsoft", "windowsapps")) {
			continue
		}
		for _, pythonCmd := range pythonCmds {
			for _, ext := range exts {
				path := filepath.Join(dir, pythonCmd+ext)
				_, err := os.Lstat(path)
				if err != nil && !os.IsNotExist(err) {
					return "", "", fmt.Errorf("evaluating python execution alias: %w", err)
				}
				if os.IsNotExist(err) {
					continue
				}
				return pythonCmd, path, nil
			}
		}
	}

	return "", "", errors.New("no python execution alias found")
}

// VirtualEnvCommand returns an *exec.Cmd for running a command from the specified virtual environment
// directory.
func VirtualEnvCommand(virtualEnvDir, name string, arg ...string) *exec.Cmd {
	if runtime.GOOS == windows {
		name = name + ".exe"
	}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Read the wrapped %w error to identify the underlying OS failure and fix that (permissions, path length, disk state).
  2. Run `pulumi` from an elevated shell once to rule out ACL denials on WindowsApps.
  3. If the alias is broken, remove it via Settings > Apps > Advanced app settings > App execution aliases and reinstall Python from the Store or python.org with PATH enabled.
  4. Reboot after a Store Python update so reparse points are refreshed.
Defensive patterns

Strategy: try-catch

Validate before calling

// Windows pre-check
dir := filepath.Join(os.Getenv("LOCALAPPDATA"), "Microsoft", "WindowsApps")
if _, err := os.Lstat(filepath.Join(dir, "python.exe")); err != nil && !os.IsNotExist(err) {
	return fmt.Errorf("WindowsApps dir is unhealthy (%v); fix permissions/alias before proceeding", err)
}

Try / catch

path, cmd, err := toolchain.CommandPath()
if err != nil && strings.Contains(err.Error(), "evaluating python execution alias") {
	// fall back to a manually configured interpreter
	path = os.Getenv("PULUMI_PYTHON_CMD")
}

Prevention

When it happens

Trigger: On Windows, Lstat(filepath.Join(windowsAppsDir, pythonCmd+ext)) fails with an unexpected OS error (e.g. permission denied, path too long, broken reparse point) while resolving aliases for pythonCmds.

Common situations: Restrictive ACLs or antivirus interference on the WindowsApps directory; corrupted reparse points after a Store update; symlink/alias left dangling after uninstalling the Store Python.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/981bd75e02e5b5ee. Report an issue: GitHub.