Skip to content

[BUG] cannot import protovalidate : no attribute FieldPathElement #292

@lazarillo

Description

@lazarillo

Description

It's quite clear that I am making a simple mistake, but I cannot find it in the other issues or in the documentation.

I have pip-installed protovalidate, and when I try to import it, I get the following:

>>> import protovalidate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../Library/Python/3.11/lib/python/site-packages/protovalidate/__init__.py", line 15, in <module>
    from protovalidate import validator
  File ".../Library/Python/3.11/lib/python/site-packages/protovalidate/validator.py", line 20, in <module>
    from protovalidate.internal import constraints as _constraints
  File ".../Library/Python/3.11/lib/python/site-packages/protovalidate/internal/constraints.py", line 187, in <module>
    def _field_to_element(field: descriptor.FieldDescriptor) -> validate_pb2.FieldPathElement:
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'buf.validate.validate_pb2' has no attribute 'FieldPathElement'

Steps to Reproduce

All I did was pip install protovalidate, and then try to import, as shown above.

Relevant environment details are below.

Expected Behavior

That I can load the package.

Actual Behavior

Shown above

Screenshots/Logs

Environment

> python -m pip show protovalidate
Name: protovalidate
Version: 0.7.1
Summary: Protocol Buffer Validation for Python
> python --version
Python 3.11.11
> uname -a
Darwin <my computer's name> 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6030 arm64
> buf --version
1.53.0

Possible Solution

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions