anomalyco/sst · error
failed to install dependencies: %w
Error message
failed to install dependencies: %w
What it means
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'.
Source
Thrown at pkg/runtime/python/build.go:565
func installDependenciesForBuild(ctx context.Context, input *runtime.BuildInput, projectInfo *projectInfo) error {
if err := os.MkdirAll(input.Out(), 0755); err != nil {
return fmt.Errorf("failed to create output directory: %w", err)
}
requirementsFile := filepath.Join(input.Out(), "requirements.txt")
if err := generateOrCopyRequirementsFile(ctx, projectInfo, requirementsFile); err != nil {
return fmt.Errorf("failed to generate requirements file: %w", err)
}
// Determine architecture for Lambda
architecture := "x86_64"
if props, err := parseInputProperties(input); err == nil && props.Architecture != "" {
architecture = props.Architecture
}
// Install dependencies for the target platform (Linux)
if err := installDependenciesForLambda(ctx, input, projectInfo, architecture); err != nil {
return fmt.Errorf("failed to install dependencies: %w", err)
}
return nil
}
// generateOrCopyRequirementsFile generates requirements.txt once per workspace,
// then copies it to each function's output directory.
func generateOrCopyRequirementsFile(ctx context.Context, projectInfo *projectInfo, outputFile string) error {
// Include dev dependencies for projects without a build system (source-only projects).
// If the project has no [build-system], runtime deps may be in the dev group.
noDev := true
if projectInfo.PyprojectPath != "" {
if !hasBuildConfig(filepath.Dir(projectInfo.PyprojectPath)) {
noDev = false
}
}
// Determine if this is a workspace member (has its own pyproject.toml in a subdirectory)View on GitHub (pinned to a0bd20f762)
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
Example fix
// before: pip resolves with local platform, failing on macOS for x86_64 Lambda // after: reproduce install exactly as the build does python3 -m pip install -r requirements.txt \ --platform manylinux2014_x86_64 --only-binary=:all: --target /tmp/lambda-test
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := exec.LookPath("python3"); err != nil { log.Fatal("python3 not on PATH") }
if _, err := exec.LookPath("docker"); err != nil && containerBuild { log.Fatal("docker required for container builds") }
// pre-resolve deps the way the build does:
// python3 -m pip install -r requirements.txt --platform manylinux2014_x86_64 --only-binary=:all: --target /tmp/probe Try / catch
err := deploy()
if err != nil && strings.Contains(err.Error(), "failed to install dependencies") {
// read the wrapped pip/docker error above this line in logs;
// common causes: no toolchain, PyPI blocked, docker daemon down
if errors.Is(err, dockerNotRunning) { startDockerDaemon() }
os.Exit(1)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to copy synced dependencies: %w
- failed to generate requirements file: %w
- failed to filter requirements: %w
- failed to run uv pip install: %v %s Function: %s Handler: %
- failed to copy dependencies to artifact: %w
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/dd021275c79cad1e.
Report an issue: GitHub.