google/protobuf is a key dependency of python grpc.
Shortly, gRPC-based will be published that contain either a top-level 'google' package, and in some cases other modules in the google/protobuf package.
At the moment using, any of these other packages will generally fail because the protobuf package is installed
- the other google package will contain modules with the google package (sometimes in google/protobuf)
- when the protobuf package is installed, both google and google/protobuf end up being resolved to the protobuf package
- other paths on the sys.path are not searched
The result is importing modules from the other packages ends with 'No module named logging.v1' for snippets like:
from google.logging.v1 import ....
There is well-known way to resolve this using pkgutil
- Use pkgutil.extend_path inside the init.py of the google and google/protobuf packages
E.g,
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
A good online resource explaining this use of pkgutil is available at pymotw:pkgutil