Skip to content

test '<name>_test' target fails on 0.22 with --noexperimental_python_import_all_repositories set #1241

@mark-thm

Description

@mark-thm

🐞 bug report

Affected Rule

compile_pip_requirements

Is this a regression?

Yes, this problem was not present in 0.21.0.

Description

When test --noexperimental_python_import_all_repositories is configured in .bazelrc and when testing the <name>_test target results in the error:

Traceback (most recent call last):
  File "<snip>/execroot/_main/bazel-out/k8-fastbuild/bin/requirements_test.runfiles/rules_python~0.22.0/python/pip_install/tools/dependency_resolver/dependency_resolver.py", line 26, in <module>
    from python.runfiles import runfiles
ModuleNotFoundError: No module named 'python'

🔬 Minimal Reproduction

Update examples/bzlmod/.bazelrc to include the line:

test --noexperimental_python_import_all_repositories

Run bazel test //:requirements_test.

🔥 Exception or Error


Traceback (most recent call last):
  File "/execroot/_main/bazel-out/k8-fastbuild/bin/requirements_test.runfiles/rules_python~0.22.0/python/pip_install/tools/dependency_resolver/dependency_resolver.py", line 26, in 
    from python.runfiles import runfiles
ModuleNotFoundError: No module named 'python'

🌍 Your Environment

Operating System:

  
Linux
  

Output of bazel version:

  
Bazelisk version: v1.12.2
Build label: 6.2.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue May 9 18:33:08 2023 (1683657188)
Build timestamp: 1683657188
Build timestamp as int: 1683657188
  

Rules_python version:

  
0.22.0
  

Anything else relevant?

It looks like #1124 updated dependency_resolver.py to include a new dependency on python.runfiles.

We incorporated this option during our upgrade from 0.9.0 to 0.10.2 based on the guidance in #792 after running into some PYTHONPATH length problems -- the 0.10.x series added site-packages to the deps repository layouts which pushes the path a bit further. I believe we've changed how we use of all_requirements since/it appears we're able to remove the config flag, for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions