Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load package for //py/web:requirements.txt: not found. #172

Closed
skyl opened this issue Apr 10, 2019 · 3 comments
Closed

Unable to load package for //py/web:requirements.txt: not found. #172

skyl opened this issue Apr 10, 2019 · 3 comments

Comments

@skyl
Copy link

skyl commented Apr 10, 2019

I'm trying to add a simple Django app to my bazel monorepo.

To my root WORKSPACE I've added:

### rules_python
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
    name = "io_bazel_rules_python",
    remote = "https://github.com/bazelbuild/rules_python.git",
    commit = "fa6ab781188972aa2710310b29a9bccaae7fd7fe",
)
# Only needed for PIP support:
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories")
pip_repositories()
load("@io_bazel_rules_python//python:pip.bzl", "pip_import")
pip_import(
    name = "pyweb",
    requirements = "//py/web:requirements.txt",
)
load("@pyweb//:requirements.bzl", "pip_install")
pip_install()
### end rules_python

Then, at py/web/requirements.txt I have a normal requirements file from pip freeze.

I have a BUILD file at py/web/myapp/BUILD with:

package(default_visibility = ["//visibility:public"])

load("@pyweb//:requirements.bzl", "all_requirements")

py_binary(
    name = "manage",
    srcs = ["manage.py"],
    python_version = "PY3",
    deps = all_requirements,
)

I try to run bazel run //py/web/myapp:manage but my requirements.txt can not be found:

ERROR: error loading package '': Encountered error while reading extension file 'requirements.bzl': no such package '@pyweb//': Trac
eback (most recent call last):
        File "/private/var/tmp/_bazel_i871067/582c43307c634a2c875ee31a5da68b63/external/io_bazel_rules_python/python/pip.bzl", line 26
                repository_ctx.execute(["python", repository_ctx.path(r...("")])
        File "/private/var/tmp/_bazel_i871067/582c43307c634a2c875ee31a5da68b63/external/io_bazel_rules_python/python/pip.bzl", line 32, in repository_ctx.execute
                repository_ctx.path(repository_ctx.attr.requirements)
Unable to load package for //py/web:requirements.txt: not found.

I'm sure I'm missing some small detail here. I wonder if someone can help me spot it. Thanks!

@ali5h
Copy link

ali5h commented Apr 16, 2019

You need an empty BUILD file in py/web

@skyl
Copy link
Author

skyl commented May 13, 2019

Thank you @ali5h.

@skyl skyl closed this as completed May 13, 2019
@skyl
Copy link
Author

skyl commented May 13, 2019

After fixing this I still can not get rules_python to work however, I get an error similar to this one: #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants