rules_py icon indicating copy to clipboard operation
rules_py copied to clipboard

[Bug]: Conflicting symlinks found when attempting to create venv.

Open anuragkanungo opened this issue 1 year ago • 3 comments

What happened?

Using version 0.7.3 I am seeing

-----------------------------------------------------------------------------
Error:   × Unable to run command:
  ├─▶ Conflicting symlinks found when attempting to create venv. More than one
  │   package provides the file at these paths
  ├─▶ pip_deps_mcap_protobuf_support/site-packages/tests/test_writer.py
  ╰─▶ site-packages/tests/test_writer.py

These are the files

./bazel-voxel/external/pip_deps_mcap/site-packages/tests/test_writer.py
./bazel-voxel/external/pip_deps_mcap_protobuf_support/site-packages/tests/test_writer.py

In a typical pip installation the second file overwrites the first one.

Version

Development (host) and target OS/architectures: Linux x86-64

Output of bazel --version: bazel 7.1.0

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file: 0.7.3

Language(s) and/or frameworks involved:

How to reproduce

Adding these pip packages

mcap==0.0.15
mcap-protobuf-support==0.0.9


### Any other information?

_No response_

anuragkanungo avatar Jun 29 '24 18:06 anuragkanungo

In a typical pip installation the second file overwrites the first one.

Are the file contents checked before overwriting, or only the name taken into consideration? If so, then which one wins? My concern is that the ordering of the dependencies matter here, and rules_py will need to ensure the same dependency ordering as pip, which may not be possible.

In this case, both those libraries should not be shipping test cases into the distribution package.

mattem avatar Jul 04 '24 16:07 mattem

Discussed with Matt that this injected __init__.py that rules_python puts in namespaced-packages https://github.com/bazelbuild/rules_python/blob/03854a20c39e9e9bfebe91802102715cb027220a/python/private/pypi/whl_installer/namespace_pkgs.py#L95-L96 is a particularly gross violation triggering this error.

Will probably just allow these conflicting symlinks and print a warning, then add a flag letting you suppress that warning.

alexeagle avatar Jul 11 '24 18:07 alexeagle

I get a similar error

Error:   × Unable to run command:
  ├─▶ Conflicting symlinks found when attempting to create venv. More than one
  │   package provides the file at these paths
  ├─▶ rules_python~~pip~rules_ros_pip_deps_38_pyyaml/site-packages/yaml/
  │   loader.py
  ╰─▶ site-packages/yaml/loader.py

Allowing these conflicts and printing a warning seems like a reasonable approach.

hofbi avatar Jul 17 '24 17:07 hofbi

Is the intended solution here to use package_collisions='ignore' any time this happens? Or should we wait for a long term fix?

(I am hitting this when installing pandera[polars] and polars).

antspy avatar Dec 14 '24 12:12 antspy