Oops, sorry, the illustration of the three files is wrong. It was meant
to be
src/
| ---- script.py
| ---- service_pb2.py
| ---- service_pb2_grpc.py
The three files are in the same directory.
On 9/23/21 3:08 PM, Jan Lukavský wrote:
Hi,
I'm facing issues importing dependencies of my Python Pipeline. I
intend to use gRPC to communicate with remote RPC service, hence I
have the following project structure:
script.py
|---- service_pb2.py
|---- service_pb2_grpc.py
I created setup.py with something like
setup(name='...',
version='1.0',
description='...',
py_modules=['service_pb2', 'service_pb2_grpc'])
That seems to work, it packages the dependencies, for example by
'python3 setup.py sdist'. I pass this file to the Pipeline using
--setup_file, but I have no luck using the module. Though the script
is executed, it fails once I try to open a channel using (DoFn.setup):
def setup(self):
self.channel = grpc.insecure_channel(self.address)
self.stub = service_pb2_grpc.RpcServiceStub(self.channel)
with exception ModuleNotFoundError: No module named 'service_pb2_grpc'.
Am I doing something obviously wrong?
Jan