I'm new to Bazel Python, so trying to follow the examples in https://github.com/aspect-build/bazel-examples/tree/main/oci_python_image.
The oci_python_image example builds and runs well without any modification.
But after I added a new depedency like "numpy" to it
py_library(
name = "hello_world_lib",
srcs = [
"__init__.py",
"app.py",
],
imports = [".."],
visibility = ["//oci_python_image:__subpackages__"],
deps = [
"@pip//cowsay",
"@pip//numpy",
],
)
and requirements.txt file updated to
# This file is imported into /requirements/all.txt, so
# these requirements are constraint-solved and pinned with the rest of the monorepo.
cowsay
testcontainers
numpy
The build bazel run oci_python_image/hello_world:image_load fails with error message
ERROR: /.../bazel-examples-main/oci_python_image/hello_world/BUILD.bazel:8:11: no such package '@@rules_python++pip+pip//numpy': BUILD file not found in directory 'numpy' of external repository @@rules_python++pip+pip. Add a BUILD file to a directory to mark it as a package. and referenced by '//oci_python_image/hello_world:hello_world_lib'
Version Local OS: MacOs Sonoma Version 14.1.1 Output of bazel --version: bazel 8.3.0
Is there something wrong with my config? Thanks!
How to reproduce
- Download code repository https://github.com/aspect-build/bazel-examples
- Make the edits above, and
bazel run oci_python_image/hello_world:image_load
Looking around missing pieces to config, but haven't found any so far.