No module named 'google.api' when installing via setuptools
type: question
First, I'm not sure whether this bug report belongs here or elsewhere, move it to the appropriate place if needed.
We are having a weird problem than can only be reproduced in AlmaLinux 9, and based on investigations, it's directly related to setuptools and how it deals with dependencies. The original report in our project can be found [here](https://github.com/AlmaLinux/build-system/issues/232) and it already includes information about what's going on.
#### Environment details
- OS type and version: AlmaLinux 9
- Python version: Python 3.9
- pip version: Not relevant as the problem is not present when installing dependencies via pip
- setuptools version: setuptools-53.0.0
- `googleapis-common-protos` version: > 1.61.0
#### Steps to reproduce
1. Clone https://github.com/AlmaLinux/alma-sbom.git
2. Create a venv: `python3 -m venv env && source env/bin/activate`
3. Build and install alma-sbom: `python setup.py install`
4. Run alma-sbom: `python --help`
#### Stack trace
```
(env) [root@alma-sbom-env alma-sbom]# ./alma_sbom.py --help
Traceback (most recent call last):
File "/root/alma-sbom/./alma_sbom.py", line 13, in <module>
from immudb_wrapper import ImmudbWrapper
File "<frozen zipimport>", line 259, in load_module
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_wrapper-0.1.1-py3.9.egg/immudb_wrapper.py", line 15, in <module>
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_py-1.4.0-py3.9.egg/immudb/__init__.py", line 13, in <module>
from immudb.client import ImmudbClient
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_py-1.4.0-py3.9.egg/immudb/client.py", line 18, in <module>
from immudb import grpcutils
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_py-1.4.0-py3.9.egg/immudb/grpcutils.py", line 20, in <module>
import immudb.grpc.schema_pb2_grpc as schema_pb2_grpc
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_py-1.4.0-py3.9.egg/immudb/grpc/schema_pb2_grpc.py", line 6, in <module>
from . import schema_pb2 as schema__pb2
File "/root/alma-sbom/env/lib64/python3.9/site-packages/immudb_py-1.4.0-py3.9.egg/immudb/grpc/schema_pb2.py", line 16, in <module>
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
ModuleNotFoundError: No module named 'google.api'
```
As a temporary solution, and since these deps are being pulled by one 3rd party dep of us ([immudb-py](https://github.com/codenotary/immudb-py)), we have added both `googleapis-common-protos==1.61.0` and `protobuf==3.20.3` as dependencies of our `immudb-wrapper` and it solved the issue. However, I would like to know whether this is a problem in your side, or in setuptools' side of things.
关闭于 2024-03-28 3 条评论