Skip to content

3.8.3 shipping google/__init__.py breaks google.protobuf #368

Open
@mh21

Description

@mh21

reproducer:

$ podman run --rm -it quay.io/fedora/fedora:41
(container) $ dnf install -y python3 python3-pip
(container) $ pip3 install setuptools functions-framework==3.8.2 protobuf
(container) $ python3 -c 'import google.protobuf'  # just works
(container) $ pip3 install setuptools functions-framework==3.8.3 protobuf
(container) $ python3 -c 'import google.protobuf'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import google.protobuf
ModuleNotFoundError: No module named 'google.protobuf'
(container) $ rm -f /usr/local/lib/python3.13/site-packages/google/__init__.py
(container) $ python3 -c 'import google.protobuf'  # works again

This seems to be caused by the first branch in src/google/__init__.py, as it works without pkg_resources (from setuptools) installed:

try:
    import pkg_resources

    pkg_resources.declare_namespace(__name__)
except ImportError:
  ...

This might be caused by functions-framework being installed into /usr/local/lib/python3.13/site-packages/, while protobuf is at /usr/local/lib64/python3.13/site-packages/.

Metadata

Metadata

Assignees

Labels

P1bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions