Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspace
维护者通常 10 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- build-system
调研方向
从 PR #887 和 PythonUvBuilder 工作流开始,重点查看 workflows/python_uv/packager.py,其中 traceback 显示了依赖安装的处理方式。使用同级的 lib 和 sam-app 重现文档中的 uv workspace,然后运行 sam build --beta-features。当 workspace 应用能够成功构建,且不会在 sam-app 下解析 lib 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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/[email protected]/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)
- OS: Mac
- If using SAM CLI,
sam --version: version 1.162.1 - AWS region: ap-northeast-1
Add --debug flag to any SAM CLI commands you are running
- 主要语言
- Python
- 星标
- 381
- 派生
- 161
- 平均合并
- 9 天 8 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-lambda-builders 的其他 Issue
-
python_uv: `UvConfig.compile_bytecode` is never passed to uv, so the option has no effect可能已有人在做 @xujiantop-crypto 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
aws/aws-lambda-builders#925 · 1 个 reaction ·
维护者通常 10 天内回复
-
Bytecode compiled during build is always discarded at runtime: SAM packaging writes 1980 timestamps, so timestamp-based .pyc never validate可能已有人在做 @xujiantop-crypto 于 24 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 64/100
aws/aws-lambda-builders#924 · 1 条评论 · 1 个 reaction ·
维护者通常 10 天内回复
-
stage/needs-triage type/feature
难度 4/5 3-5 天 新手友好度 38/100
aws/aws-lambda-builders#839 · 2 条评论 · 1 个 reaction ·
维护者通常 10 天内回复
-
Feature request: Skip binary validation when builder is not used for any language可能重新可做 @saketh-bandi 于 37 天前认领,目前没有进行中的 PR。 未关闭area/build contributors/good-first-issue contributors/welcome type/feature
难度 4/5 3-5 天 新手友好度 38/100
aws/aws-lambda-builders#831 · 3 条评论 ·
维护者通常 10 天内回复
-
blocked/more-info-needed type/feature
难度 5/5 一周以上 新手友好度 25/100
aws/aws-lambda-builders#713 · 2 条评论 ·
维护者通常 10 天内回复
查看 aws/aws-lambda-builders 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
awslabs/visual-asset-management-system#414 ·
维护者通常 1 天内回复
-
bug v1 v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/python-sdk#3670 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
aicell-lab/bioengine#232 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
modelscope/evalscope#1836 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100