apache / apache/beam

Python installation fails if grpc_tools is not installed

Open
#20,232 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

When installing from master branch, I'm getting an exception below. Looks like the ImportError exception handling throws an exception itself. I'll manually install grpc_tools and try again but the handling of ImportError has issues.
 
```
Traceback (most recent call last):
      File "/root/apache-beam-custom/packages/beam/sdks/python/gen_protos.py", line 292, in generate_proto_files
        from grpc_tools import protoc
    ModuleNotFoundError: No module named 'grpc_tools'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
        self.run()
      File "/opt/conda/lib/python3.7/multiprocessing/process.py", line 99, in run
        self._target(*self._args, **self._kwargs)
      File "/root/apache-beam-custom/packages/beam/sdks/python/gen_protos.py", line 378, in _install_grpcio_tools_and_generate_proto_files
        generate_proto_files(force=force)
      File "/root/apache-beam-custom/packages/beam/sdks/python/gen_protos.py", line 315, in generate_proto_files
        protoc_gen_mypy = _find_protoc_gen_mypy()
      File "/root/apache-beam-custom/packages/beam/sdks/python/gen_protos.py", line 233, in _find_protoc_gen_mypy
        (fname, ', '.join(search_paths)))
    RuntimeError: Could not find protoc-gen-mypy in /root/apache-beam-custom/bin, /root/apache-beam-custom/bin, /usr/local/bin, /opt/conda/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin
```

Imported from Jira [BEAM-9508](https://issues.apache.org/jira/browse/BEAM-9508). Original Jira may contain additional context.
Reported by: davidyan.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.