{"record":{"id":"ded950d1f9224682","repo":"chocolatey/choco","slug":"unable-to-find-pip","errorCode":null,"errorMessage":"Unable to find pip","messagePattern":"Unable to find pip","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/chocolatey/infrastructure.app/services/PythonService.cs","lineNumber":271,"sourceCode":"            {\r\n                var binRoot = Environment.GetEnvironmentVariable(EnvironmentVariables.System.ChocolateyBinRoot);\r\n                if (string.IsNullOrWhiteSpace(binRoot))\r\n                {\r\n                    binRoot = \"c:\\\\tools\";\r\n                }\r\n\r\n                topLevelPath = _fileSystem.CombinePaths(binRoot, \"python\");\r\n            }\r\n\r\n            pipPath = _fileSystem.CombinePaths(_fileSystem.GetDirectoryName(topLevelPath), \"Scripts\", \"pip.exe\");\r\n            if (_fileSystem.FileExists(pipPath))\r\n            {\r\n                _exePath = pipPath;\r\n            }\r\n\r\n            if (string.IsNullOrWhiteSpace(_exePath))\r\n            {\r\n                throw new FileNotFoundException(\"Unable to find pip\");\r\n            }\r\n        }\r\n\r\n        private string BuildArguments(ChocolateyConfiguration config, IDictionary<string, ExternalCommandArgument> argsDictionary)\r\n        {\r\n            var args = ExternalCommandArgsBuilder.BuildArguments(config, argsDictionary);\r\n\r\n            args = args.Replace(LogLevelToken, config.Debug ? \"-vvv\" : \"\");\r\n\r\n            if (config.CommandName.IsEqualTo(\"install\"))\r\n            {\r\n                args = args.Replace(ForceToken, config.Force ? \"--ignore-installed\" : \"\");\r\n            }\r\n            else if (config.CommandName.IsEqualTo(\"upgrade\"))\r\n            {\r\n                args = args.Replace(ForceToken, config.Force ? \"--force-reinstall\" : \"\");\r\n            }\r\n            else\r","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/chocolatey/choco/blob/0d5abdd10cc177a141e69547cad6935b419b6c17/src/chocolatey/infrastructure.app/services/PythonService.cs#L253-L289","documentation":"While resolving the pip executable path, PythonService searches the Scripts folder next to python.exe (pipPath = combine(dirName(topLevelPath), 'Scripts', 'pip.exe')). If pip.exe is not found and _exePath stays blank, EnsureExecutablePathSet throws FileNotFoundException.","triggerScenarios":"Python is detected but pip.exe is absent from the expected <python dir>\\Scripts\\pip.exe location, so after FileExists checks _exePath is still null/whitespace.","commonSituations":"Python installed without pip; pip installed elsewhere; custom/embeddable Python layout without Scripts; Python 2.7.x without pip bundled.","solutions":["Install pip for the detected Python (python -m ensurepip, or bootstrap via get-pip.py)","Ensure pip.exe lives in the Scripts folder next to python.exe","Reinstall Python with the pip component selected","Use a virtualenv that includes pip and point Python at it"],"exampleFix":"// before\n# pip missing -> error\n// after\npython -m ensurepip --upgrade\nchoco install requests --source=python","handlingStrategy":"validation","validationCode":"// Verify pip.exe exists in the expected Scripts folder before using the python source.\nvar scriptsDir = Path.Combine(Path.GetDirectoryName(pythonExe), \"Scripts\");\nif (!File.Exists(Path.Combine(scriptsDir, \"pip.exe\"))) {\n    Console.Error.WriteLine(\"pip not found; run: python -m ensurepip --upgrade\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try { pythonService.Install(config); }\ncatch (FileNotFoundException ex) when (ex.Message == \"Unable to find pip\") {\n    // bootstrap pip then retry\n    Process.Start(\"python\", \"-m ensurepip --upgrade\").WaitForExit();\n    pythonService.Install(config);\n}","preventionTips":["Install Python with pip components included","Run python -m ensurepip --upgrade to provision pip","Keep pip.exe in the Scripts folder next to python.exe"],"tags":["python","pip","executable-not-found"],"backgroundTag":null,"analyzedSha":"0d5abdd10cc177a141e69547cad6935b419b6c17","analyzedAt":"2026-08-13T18:33:03.301Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}