Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspace

Đang mở
#892 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
build-system

Hướng nghiên cứu

Bắt đầu với PR #887 và workflow PythonUvBuilder, đặc biệt là workflows/python_uv/packager.py, nơi traceback cho thấy cách xử lý việc cài đặt dependency. Tái hiện uv workspace được tài liệu hóa với lib và sam-app nằm cùng cấp, sau đó chạy sam build --beta-features. Hoàn tất khi ứng dụng trong workspace build thành công mà không resolve lib bên dưới sam-app.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

stage/needs-triage
Description:

An application created as a member of a uv workspace would fail to build if they depended on other workspace
members.

The following shows the problematic workspace structure.

workspace root
├── lib
│   ├── pyproject.toml
│   └── src
├── pyproject.toml
├── sam-app
│   ├── __init__.py
│   ├── app.py
│   ├── pyproject.toml
│   ├── samconfig.toml
│   └── template.yaml
└── uv.lock
Steps to reproduce:
uv init --bare
uv init --lib lib
sam init --name sam-app --runtime python3.14 --architecture arm64 \
    --dependency-manager pip --package-type Zip \
    --app-template hello-world
cd sam-app
uv init
uv add lib@../lib
# remove requirements.txt and edit the app
# edit template.yaml to configure `BuildMethod: python-uv` and `CodeUri: .`
sam build --beta-features
Observed result:

The following shows the problematic workspace structure and the error message.

2026-07-15 13:49:33,345 | Building from UV lock file
2026-07-15 13:49:33,346 | Executing UV command: /Users/me/.cargo/bin/uv export --format requirements.txt --no-emit-project --no-hashes --no-default-groups --output-file
/var/folders/8s/g1znx0c90vx3tz81t_rqqgyr0000gn/T/tmptz94ffbg/lock_requirements.txt --python 3.14
2026-07-15 13:49:33,499 | UV command return code: 0
2026-07-15 13:49:33,500 | UV stdout: # This file was autogenerated by uv via the following command:
#    uv export --format requirements.txt --no-emit-project --no-hashes --no-default-groups --output-file /var/folders/8s/g1znx0c90vx3tz81t_rqqgyr0000gn/T/tmptz94ffbg/lock_requirements.txt --python 3.14
-e ./lib
    # via sam-app

2026-07-15 13:49:33,500 | UV stderr: Using CPython 3.14.6 interpreter at: /opt/homebrew/opt/python@3.14/bin/python3.14
Resolved 3 packages in 8ms

2026-07-15 13:49:33,501 | Executing UV command: /Users/me/.cargo/bin/uv pip install -r /var/folders/8s/g1znx0c90vx3tz81t_rqqgyr0000gn/T/tmptz94ffbg/lock_requirements.txt --target
/Users/me/workspace/sam-app/.aws-sam/deps/351538c7-a05e-4aad-b5c5-928f241070b6 --cache-dir /var/folders/8s/g1znx0c90vx3tz81t_rqqgyr0000gn/T/tmptz94ffbg/uv-cache
--python-version 3.14 --python-platform aarch64-unknown-linux-gnu
2026-07-15 13:49:33,653 | UV command return code: 2
2026-07-15 13:49:33,655 | UV stdout:
2026-07-15 13:49:33,656 | UV stderr: Using CPython 3.13.0 interpreter at: /Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib

2026-07-15 13:49:33,657 | Failed to build dependencies: UV package build failed: Failed to build from pyproject.toml: Lock file operation failed: Failed to install dependencies using uv: UV pip install
failed: Using CPython 3.13.0 interpreter at: /Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib

2026-07-15 13:49:33,662 | PythonUvBuilder:ResolveDependencies failed
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 348, in _build_from_lock_file
    self._uv_runner.install_requirements(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        requirements_path=temp_requirements,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        architecture=architecture,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 167, in install_requirements
    raise UvInstallationError(reason=f"UV pip install failed: {stderr}")
aws_lambda_builders.workflows.python_uv.exceptions.UvInstallationError: Failed to install dependencies using uv: UV pip install failed: Using CPython 3.13.0 interpreter at:
/Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 389, in _build_from_pyproject
    self._build_from_lock_file(lock_path, target_dir, scratch_dir, python_version, architecture, config)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 361, in _build_from_lock_file
    raise LockFileError(reason=str(e))
aws_lambda_builders.workflows.python_uv.exceptions.LockFileError: Lock file operation failed: Failed to install dependencies using uv: UV pip install failed: Using CPython 3.13.0 interpreter at:
/Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/actions.py", line 68, in execute
    package_builder.build_dependencies(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        artifacts_dir_path=target_artifact_dir,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        config=self.config,
        ^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 229, in build_dependencies
    handler(manifest_path, artifacts_dir_path, scratch_dir_path, python_version, architecture, config)
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 282, in _handle_pyproject_build
    self._build_from_pyproject(manifest_path, target_dir, scratch_dir, python_version, architecture, config)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/packager.py", line 392, in _build_from_pyproject
    raise UvBuildError(reason=f"Failed to build from pyproject.toml: {str(e)}")
aws_lambda_builders.workflows.python_uv.exceptions.UvBuildError: UV package build failed: Failed to build from pyproject.toml: Lock file operation failed: Failed to install dependencies using uv: UV pip
install failed: Using CPython 3.13.0 interpreter at: /Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflow.py", line 374, in run
    action.execute()
    ~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.162.1/libexec/lib/python3.14/site-packages/aws_lambda_builders/workflows/python_uv/actions.py", line 76, in execute
    raise ActionFailedError(str(ex))
aws_lambda_builders.actions.ActionFailedError: UV package build failed: Failed to build from pyproject.toml: Lock file operation failed: Failed to install dependencies using uv: UV pip install failed:
Using CPython 3.13.0 interpreter at: /Users/me/workspace/.venv/bin/python3
error: Distribution not found at: file:///Users/me/workspace/sam-app/lib

2026-07-15 13:49:33,711 | Exception raised during the execution

Build Failed

Even though lib and sam-app are in the same directory level in the workspace, the workflow attempts to install lib under sam-app.

Expected result:

Successful build is expected.

Notes

I've submitted PR #887 to fix for this issue.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
  1. OS: Mac
  2. If using SAM CLI, sam --version: version 1.162.1
  3. AWS region: ap-northeast-1

Add --debug flag to any SAM CLI commands you are running

Ngôn ngữ chính
Python
Star
381
Fork
162
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws/aws-lambda-builders

Tất cả issue của aws/aws-lambda-builders

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.