-
-
Notifications
You must be signed in to change notification settings - Fork 677
ModuleNotFoundError when depending on multiple Google projects #431
Copy link
Copy link
Closed
Description
🐞 bug report
Affected Rule
The issue is caused by the rule:py_library
Is this a regression?
I think so. This was working correctly with rules_python_external. But after upgrading my requirements.txt and switching to the latest version of rules_python, I have started to see the issue again.
Description
I have a py_library the following py_library rule:
py_library(
name = "dataflow",
srcs = ["dataflow.py"],
deps = [
requirement("google-auth"),
requirement("google-auth-httplib2"),
requirement("google-api-core"),
requirement("google-api-python-client"),
requirement("python-dateutil"),
],
visibility = [
"//crestone/luigi:__subpackages__",
],
)
And get the following error:
Traceback (most recent call last):
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/Crestone/crestone/gcp/dataflow_test.py", line 8, in <module>
from crestone.gcp import dataflow
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/Crestone/crestone/gcp/dataflow.py", line 12, in <module>
from googleapiclient import discovery
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/pip/pypi__google_api_python_client/googleapiclient/discovery.py", line 50, in <module>
import google.api_core.client_options
ModuleNotFoundError: No module named 'google.api_core'
🔬 Minimal Reproduction
I have included the WORKSPACE, along with the BUILD file and the Python code that is triggering the issue:
https://github.com/JoshuaCrestone/RulesPythonImportIssues
🔥 Exception or Error
Traceback (most recent call last):
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/Crestone/crestone/gcp/dataflow_test.py", line 8, in
from crestone.gcp import dataflow
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/Crestone/crestone/gcp/dataflow.py", line 12, in
from googleapiclient import discovery
File "/home/joshua/.cache/bazel/_bazel_joshua/3a56d58236696fc82ab667141944da13/sandbox/linux-sandbox/53/execroot/Crestone/bazel-out/k8-fastbuild/bin/crestone/gcp/dataflow_test.runfiles/pip/pypi__google_api_python_client/googleapiclient/discovery.py", line 50, in
import google.api_core.client_options
ModuleNotFoundError: No module named 'google.api_core'
🌍 Your Environment
Operating System:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
Output of bazel version:
$ bazel version
Build label: 3.1.0- (@non-git)
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Aug 17 09:48:11 2020 (1597657691)
Build timestamp: 1597657691
Build timestamp as int: 1597657691
Rules_python version:
0.1.0
Anything else relevant?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels