You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a py_binary target with dependencies that include NumPy and other libraries requiring C-extensions, the runtime fails to locate the required C-extension libraries. This results in an ImportError for NumPy's C-extensions, even though the same environment works correctly when run outside of Bazel in a local virtual environment.
I think you're running into #1675. I see that your example is setup to use Python 3.11, but when I run it on my machine, numpy says I'm running 3.12 which is the host version.
Either disabling bzlmod (--noenable_bzlmod) or moving to the bzlmod Python rules resolves the issue. For the latter, clear out the WORKSPACE file and add the following to MODULE.bazel.
🐞 bug report
Affected Rule
The issue is caused by the rule:
py_binary
Is this a regression?
No
Description
When running a py_binary target with dependencies that include NumPy and other libraries requiring C-extensions, the runtime fails to locate the required C-extension libraries. This results in an ImportError for NumPy's C-extensions, even though the same environment works correctly when run outside of Bazel in a local virtual environment.
🔬 Minimal Reproduction
Minimal Reproduction Repository
🔥 Exception or Error
🌍 Your Environment
Operating System:
The text was updated successfully, but these errors were encountered: