bazel-contrib/rules_python

`PIP_REQUIRE_VIRTUALENV` breaks installation of dependencies from `.tar.gz` URIs

Open

#3,138 创建于 2025年8月4日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Starlark (705 fork)auto 404
help wantedtype: pip

仓库指标

Star
 (679 star)
PR 合并指标
 (PR 指标待抓取)

描述

🐞 bug report

Affected Rule

This might be related to how wheel_installer is invoked.

Is this a regression?

No, 1.4.1 and https://github.com/bazel-contrib/rules_python/pull/3115 (commit https://github.com/bazel-contrib/rules_python/commit/75871bbb9b33723c60565de0d7959c3262f87337) have this problem. 1.5.0 and 1.5.1 likely also have this problem, but I can't confirm since .tar.gz installation is broken in those releases (see #3131).

Description

Running a py_test target with PIP_REQUIRE_VIRTUALENV set to true results in errors if one of the dependencies is installed from a .tar.gz URI. Adding common --action_env PIP_REQUIRE_VIRTUALENV=false to .bazelrc can be used as a workaround.

🔬 Minimal Reproduction

export PIP_REQUIRE_VIRTUALENV=true in the shell. Then follow the minimal reproduction steps in #3131 but for rules_python 1.4.1 or https://github.com/bazel-contrib/rules_python/pull/3115 (commit https://github.com/bazel-contrib/rules_python/commit/75871bbb9b33723c60565de0d7959c3262f87337). 1.5.0 and 1.5.1 would fail with a different error due to #3131.

🔥 Exception or Error

🌍 Your Environment

Operating System:

Output of bazel version:

Rules_python version:

Anything else relevant?

贡献者指南