chocolatey/choco · error · NotImplementedException

This source is not supported on non-Windows systems

Error message

This source is not supported on non-Windows systems

What it means

PythonService.EnsureSourceAppRegistered throws NotImplementedException on non-Windows platforms. The Python (pip) source type is implemented only for Windows, so any attempt to initialize it elsewhere fails fast.

Source

Thrown at src/chocolatey/infrastructure.app/services/PythonService.cs:178

            {
                ArgumentOption = "",
                ArgumentValue = ForceToken,
                QuoteValue = false,
                UseValueOnly = true,
                Required = true
            });
        }

        public string SourceType
        {
            get { return SourceTypes.Python; }
        }

        public void EnsureSourceAppInstalled(ChocolateyConfiguration config, Action<PackageResult, ChocolateyConfiguration> ensureAction)
        {
            if (Platform.GetPlatform() != PlatformType.Windows)
            {
                throw new NotImplementedException("This source is not supported on non-Windows systems");
            }

            //ensure at least python 2.7.9 is installed
            var python = _fileSystem.GetExecutablePath("python");
            //python -V

            if (python.IsEqualTo("python"))
            {
                var runnerConfig = new ChocolateyConfiguration
                {
                    Sources = ApplicationParameters.PackagesLocation,
                    Debug = config.Debug,
                    Force = config.Force,
                    Verbose = config.Verbose,
                    CommandExecutionTimeoutSeconds = config.CommandExecutionTimeoutSeconds,
                    CacheLocation = config.CacheLocation,
                    RegularOutput = config.RegularOutput,
                    PromptForConfirmation = false,

View on GitHub (pinned to 0d5abdd10c)

Solutions

  1. Run Python-source commands on a Windows host only
  2. Manage Python packages with pip directly on non-Windows systems
  3. Guard Python-source commands on platform before invoking them

Example fix

// before
choco install requests --source=python  # on Linux
// after
# on non-Windows, use pip directly:
pip install requests
Defensive patterns

Strategy: type-guard

Validate before calling

if (Platform.GetPlatform() != PlatformType.Windows) {
    Console.Error.WriteLine("Python source is Windows-only; use pip directly.");
    return;
}

Type guard

static bool IsPythonSourceSupported() => Platform.GetPlatform() == PlatformType.Windows;

Prevention

When it happens

Trigger: Using the Python source type (--source python or SourceTypes.Python) on Linux or macOS where Platform.GetPlatform() != PlatformType.Windows, when the source is ensured/initialized.

Common situations: Running Chocolatey CLI on Linux/macOS attempting to manage pip packages; cross-platform scripts that assume Windows; CI matrix including non-Windows nodes.

Related errors


AI-assisted analysis of chocolatey/choco@0d5abdd10c (2026-08-13). Data as JSON: /api/errors/1e46d8232be9afd1. Report an issue: GitHub.