{"record":{"id":"dd021275c79cad1e","repo":"anomalyco/sst","slug":"failed-to-install-dependencies-w","errorCode":null,"errorMessage":"failed to install dependencies: %w","messagePattern":"failed to install dependencies: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":565,"sourceCode":"func installDependenciesForBuild(ctx context.Context, input *runtime.BuildInput, projectInfo *projectInfo) error {\n\tif err := os.MkdirAll(input.Out(), 0755); err != nil {\n\t\treturn fmt.Errorf(\"failed to create output directory: %w\", err)\n\t}\n\n\trequirementsFile := filepath.Join(input.Out(), \"requirements.txt\")\n\tif err := generateOrCopyRequirementsFile(ctx, projectInfo, requirementsFile); err != nil {\n\t\treturn fmt.Errorf(\"failed to generate requirements file: %w\", err)\n\t}\n\n\t// Determine architecture for Lambda\n\tarchitecture := \"x86_64\"\n\tif props, err := parseInputProperties(input); err == nil && props.Architecture != \"\" {\n\t\tarchitecture = props.Architecture\n\t}\n\n\t// Install dependencies for the target platform (Linux)\n\tif err := installDependenciesForLambda(ctx, input, projectInfo, architecture); err != nil {\n\t\treturn fmt.Errorf(\"failed to install dependencies: %w\", err)\n\t}\n\n\treturn nil\n}\n\n// generateOrCopyRequirementsFile generates requirements.txt once per workspace,\n// then copies it to each function's output directory.\nfunc generateOrCopyRequirementsFile(ctx context.Context, projectInfo *projectInfo, outputFile string) error {\n\t// Include dev dependencies for projects without a build system (source-only projects).\n\t// If the project has no [build-system], runtime deps may be in the dev group.\n\tnoDev := true\n\tif projectInfo.PyprojectPath != \"\" {\n\t\tif !hasBuildConfig(filepath.Dir(projectInfo.PyprojectPath)) {\n\t\t\tnoDev = false\n\t\t}\n\t}\n\n\t// Determine if this is a workspace member (has its own pyproject.toml in a subdirectory)","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L547-L583","documentation":"installDependenciesForBuild delegates actual dependency installation to installDependenciesForLambda (pip install of requirements for the target Lambda architecture). Any failure inside that pipeline — pip invocation, container build, copying source or synced deps — is surfaced here as 'failed to install dependencies'.","triggerScenarios":"installDependenciesForLambda returns an error: python3/pip not found or wrong version in PATH, pip resolve failure from bad requirements, Docker unavailable for container builds, or any copySourceFilesSimple/copySyncedDependencies failure.","commonSituations":"No Python toolchain on the CI runner or a Python 2 'python' binary in PATH; requirements.txt pins a package/version that doesn't exist for the target architecture; Docker daemon not running for container-based builds; corporate proxy blocking PyPI.","solutions":["Ensure python3 and pip (matching the runtime version) are on PATH: `python3 --version && python3 -m pip --version`","Run `pip install -r <output>/requirements.txt --platform manylinux2014_x86_64 --target /tmp/test` locally to see the real resolve failure","For container builds, verify Docker is installed and the daemon is running (docker info)","Read the wrapped inner error and the pip output above it in the logs for the specific package/network failure"],"exampleFix":"// before: pip resolves with local platform, failing on macOS for x86_64 Lambda\n// after: reproduce install exactly as the build does\npython3 -m pip install -r requirements.txt \\\n  --platform manylinux2014_x86_64 --only-binary=:all: --target /tmp/lambda-test","handlingStrategy":"try-catch","validationCode":"if _, err := exec.LookPath(\"python3\"); err != nil { log.Fatal(\"python3 not on PATH\") }\nif _, err := exec.LookPath(\"docker\"); err != nil && containerBuild { log.Fatal(\"docker required for container builds\") }\n// pre-resolve deps the way the build does:\n// python3 -m pip install -r requirements.txt --platform manylinux2014_x86_64 --only-binary=:all: --target /tmp/probe","typeGuard":null,"tryCatchPattern":"err := deploy()\nif err != nil && strings.Contains(err.Error(), \"failed to install dependencies\") {\n\t// read the wrapped pip/docker error above this line in logs;\n\t// common causes: no toolchain, PyPI blocked, docker daemon down\n\tif errors.Is(err, dockerNotRunning) { startDockerDaemon() }\n\tos.Exit(1)\n}","preventionTips":["Install the Python version matching your Lambda runtime in CI images","Pre-test pip resolution with --platform manylinux2014 for the target architecture","Verify docker info succeeds before container builds","Configure proxy/PIP_INDEX_URL when behind a corporate firewall"],"tags":["python","pip","dependencies","build","lambda"],"backgroundTag":"pip-install-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}