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
# Image for the API
py3_image(
name = "api_docker",
srcs = [":api"],
base = ":python3.7_image",
main = "main.py",
visibility = ["//visibility:public"],
)
py_binary(
name = "api",
srcs = glob(
["*.py"],
),
main = "main.py",
python_version = "PY3",
srcs_version = "PY3",
deps = [
"//lib/kubernetes:kubernetes_util",
"@requirements_py3//docopt",
"@requirements_py3//dulwich",
"@requirements_py3//flask",
"@requirements_py3//gevent",
"@requirements_py3//prometheus_client",
],
)
The first thing in main.py is
from gevent import monkey
monkey.patch_all()
When I try to bazel run the docker image, I get this:
Traceback (most recent call last):
File "/app/apps/switchboard/api/api_docker.binary.runfiles/com_something/apps/switchboard/api/main.py", line 10, in <module>
from gevent import monkey
ImportError: cannot import name 'monkey' from 'gevent' (/app/apps/switchboard/api/api_docker.binary.runfiles/requirements_py3/gevent/__init__.py)
The application works as expected when running the py_binary with bazel run
Any known issues regarding using a container with pip_repository?
The text was updated successfully, but these errors were encountered:
It looks to me that this is because all libraries are in requirements_py3 folder and python_stub from bazel loads only directories inside .binary.runfiles. So it will load the requirements_py3 folder, but nothing inside it.
All libraries should go to binary.runfiles dir instead, I think.
WORKSPACE stuff:
I have this defined in my BUILD:
The first thing in main.py is
When I try to
bazel run
the docker image, I get this:The application works as expected when running the py_binary with
bazel run
Any known issues regarding using a container with pip_repository?
The text was updated successfully, but these errors were encountered: