Description
🐞 bug report
Affected Rule
No single rule, combination of pip.parse and py_binary under bzlmod
Is this a regression?
Somewhat, works under WORKSPACE but not under bzlmod. Also tested on a couple of older versions of rules_python, with same error
Description
Attempting to import asyncpg under bzlmod fails with ModuleNotFoundError
when it attempts to import a cython module .so. Using the exact same requirements lock file and src files under WORKSPACE, there is no error.
Looking at the generated runfiles, the required .so appears to be present but I haven't dug any deeper to check for differences in path etc.
🔬 Minimal Reproduction
Use repo here: https://github.com/aaliddell/rules_python_bzlmod_asyncpg_demo
Run with bazel run //:test
and you will get no error
Run with bazel run --enable_bzlmod //:test
and you should get error
🔥 Exception or Error
Traceback (most recent call last):
File "<snip>/_main/app/src/main.py", line 2, in <module>
import asyncpg
File "<snip>/rules_python~0.21.0~pip~pip_deps_asyncpg/site-packages/asyncpg/__init__.py", line 8, in <module>
from .connection import connect, Connection # NOQA
File "<snip>/rules_python~0.21.0~pip~pip_deps_asyncpg/site-packages/asyncpg/connection.py", line 23, in <module>
from . import connect_utils
File "<snip>/rules_python~0.21.0~pip~pip_deps_asyncpg/site-packages/asyncpg/connect_utils.py", line 30, in <module>
from . import protocol
File "<snip>/rules_python~0.21.0~pip~pip_deps_asyncpg/site-packages/asyncpg/protocol/__init__.py", line 9, in <module>
from .protocol import Protocol, Record, NO_TIMEOUT, BUILTIN_TYPE_NAME_MAP
ModuleNotFoundError: No module named 'asyncpg.protocol.protocol'
🌍 Your Environment
Operating System:
Fedora 38
Linux 6.2.14-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 1 00:55:28 UTC 2023 x86_64 GNU/Linux
Output of bazel version
:
Bazelisk version: v1.16.0
Build label: 6.1.1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Mar 15 15:44:56 2023 (1678895096)
Build timestamp: 1678895096
Build timestamp as int: 1678895096
Rules_python version:
0.21.0
Anything else relevant?