bazel-contrib / bazel-contrib/rules_python

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

Đang mở
#3,138 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
help wanted type: pip
Ngôn ngữ chính
Starlark
Star
688
Fork
721
Merge trung bình
15 giờ 7 phút
Pull request đã merge (30 ngày)
76

Mô tả

# 🐞 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

  error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 3
╰─> [1 lines of output]
ERROR: Could not find an activated virtualenv (required).
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 3
╰─> See above for output.

## 🌍 Your Environment

**Operating System:**

  

Linux

**Output of `bazel version`:**

  

Bazelisk version: development
Build label: 8.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Feb 25 18:50:42 2025 (1740509442)
Build timestamp: 1740509442
Build timestamp as int: 1740509442

**Rules_python version:**

  

1.4.1, 75871bbb9b33723c60565de0d7959c3262f87337

**Anything else relevant?**

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

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

Hướng nghiên cứu

Bắt đầu với các bước tái hiện tối thiểu được tham chiếu trong #3131, sử dụng rules_python 1.4.1 và PIP_REQUIRE_VIRTUALENV=true. Kiểm tra cách wheel_installer được gọi cho một dependency .tar.gz; hoàn tất khi một target py_test cài đặt dependency đó thành công mà không cần workaround .bazelrc.

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

Đánh giá

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

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.