[Bug]: `resolutions.from_requirements` installs all packages from requirements instead of using requirements to resolve virtual dependencies
What happened?
After adding PyQt6 to the dependencies I see the following when trying to create a venv for a target that does not depend on this package:
├─▶ Conflicting symlinks found when attempting to create venv. More than one package provides the file at these paths
├─▶ django_pyqt6/site-packages/PyQt6/__init__.py
╰─▶ site-packages/PyQt6/__init__.py
Version
Development (host) and target OS/architectures:
Output of bazel --version: 7.0.2
Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: HEAD (v0.7.3+)
Language(s) and/or frameworks involved:
How to reproduce
Check out https://github.com/dizzy57/rules_py/tree/venv-namespace
Run `bazel run //py/tests/virtual/django:manage`.
Any other information?
Please note that //py/tests/virtual/django:manage does not depend on PyQt6 neither directly nor transitively, but merely adding this dependency to requirements.txt makes bazel run to fail. I expect rules_py to mirror rules_python behavior here and only install bare minimum of dependencies in the virtualenv.
OpenCV seems to be afflicted with this too. Or maybe with some variant of this:
Error: × Unable to run command:
╰─▶ Conflicting symlinks found when attempting to create venv. More than one
package provides the file at these paths
╭─[1:209]
1 │ /home/foo/.cache/bazel/_bazel_foo/05195ea62fe8ff6bdb6fcbfa6efd3485/sandbox/processwrapper-sandbox/11/execroot/_main/bazel-out/k8-fastbuild/bin/datasets/coco_test.runfiles/.coco_test.venv/lib/python3.12/site-packages/cv2/version.py
· ──────────────┬─────────────
· ╰── Existing file in virtual environment
2 │ /home/foo/.cache/bazel/_bazel_foo/05195ea62fe8ff6bdb6fcbfa6efd3485/sandbox/processwrapper-sandbox/11/execroot/_main/bazel-out/k8-fastbuild/bin/datasets/coco_test.runfiles/rules_python~~pip~pypi_312_opencv_python_linux_aarch64_linux_arm_linux_ppc_linux_s390x_linux_x86_64/site-packages/cv2/version.py
· ──────────────┬─────────────
· ╰── Next file to link
╰────
help: Set `package_collisions = "warning"` on the binary or test rule to
downgrade this error to a warning
@1e100 this issue is about virtual dependencies, I think you're hitting https://github.com/aspect-build/rules_py/issues/358
Looks like it, yeah. It's annoying more than anything, once I disable the error things seem to work. The annoyance is that I have to disable it on every py_binary and py_test target that includes opencv.