Skip to content

PIP_REQUIRE_VIRTUALENV breaks installation of dependencies from .tar.gz URIsΒ #3138

@a-khabarov

Description

@a-khabarov

🐞 bug report

Affected Rule

This might be related to how wheel_installer is invoked.

Is this a regression?

No, 1.4.1 and #3115 (commit 75871bb) 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 #3115 (commit 75871bb). 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?

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions