Trying to build a set up Python package dependencies with rules_python
per these instructions but when running bazel build
I get this error:
ERROR: error loading package under directory '':
error loading package 'zzz':
Unable to find package for @my_deps//:requirements.bzl:
The repository '@my_deps' could not be resolved:
Repository '@my_deps' is not defined.
WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
rules_python_version = "740825b7f74930c62f44af95c9a4c1bd428d2c53" # Latest @ 2021-06-23
http_archive(
name = "rules_python",
sha256 = "3474c5815da4cb003ff22811a36a11894927eda1c2e64bf2dac63e914bfdf30f",
strip_prefix = "rules_python-{}".format(rules_python_version),
url = "https://github.com/bazelbuild/rules_python/archive/{}.zip".format(rules_python_version),
)
and the BUILD
file:
load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "my_deps",
requirements_lock = "requirements.txt",
)
load("@my_deps//:requirements.bzl", "install_deps", "requirement")
install_deps()
Is pip_parse
responsible for creating the repository @my_deps
? If so, why can't it be found by load
?
If it matters, this is on Windows 10.
pip_parse
should go into the WORKSPACE
file, not the BUILD
file.
If you put it in the BUILD
file by mistake, you might get this error.
Hopefully this helps a future searcher who might make the same mistake.