Description
Problem:
Despite the attempted fix in commit 0ab4b63, v3io-frames 0.13.8 still fails to work with protobuf 4.x+ versions due to an unresolved _message import
error.
Error:
ImportError: cannot import name '_message' from 'google.protobuf.pyext'
(/path/to/site-packages/google/protobuf/pyext/init.py)
Complete Stack Trace:
File "v3io_frames/init.py", line 26, in
from .grpc import Client as gRPCClient
File "v3io_frames/grpc.py", line 31, in
from .http import format_go_time
File "v3io_frames/http.py", line 32, in
from .pbutils import df2msg, msg2df, pb2py
File "v3io_frames/pbutils.py", line 18, in
from google.protobuf.pyext import cpp_message
File "google/protobuf/pyext/cpp_message.py", line 23, in
from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext'
Environment
- v3io-frames version: 0.13.8 (July 2024)
- protobuf version: 4.25.8 (should be supported)
- Python version: 3.11.13
- MLRun version: 1.9.2 (affected downstream package)
Expected Behavior
v3io-frames should work seamlessly with modern protobuf versions (4.x, 5.x, 6.x) as the library doesn't specify version constraints, indicating intended compatibility.
Impact
This compatibility issue:
- Blocks the entire MLRun ecosystem from using modern protobuf versions
- Forces users to implement monkey-patch workarounds instead of having proper compatibility
- Prevents adoption of modern Python packages that require protobuf 4.x+
- Creates dependency conflicts in production environments
Root Cause
The protobuf 4.x C++ API changes removed google.protobuf.pyext._message in the same way it was previously available. The fix in commit 0ab4b63 appears to have been incomplete or doesn't cover all code paths.
Reproduction
- Install v3io-frames 0.13.8 with protobuf 4.25.8+
- Try to import: from v3io_frames import Client
- Error occurs immediately during import
Current Workaround
Users are forced to implement this monkey patch:
import sys
from unittest.mock import MagicMock
import google.protobuf.pyext
if not hasattr(google.protobuf.pyext, '_message'):
google.protobuf.pyext._message = MagicMock()
if 'google.protobuf.pyext.cpp_message' not in sys.modules:
sys.modules['google.protobuf.pyext.cpp_message'] = MagicMock()
Request
Please:
- Complete the protobuf 4.x+ compatibility fix - the current implementation still has compatibility issues
- Add automated testing for protobuf versions 4.x through 6.x to prevent regressions
- Test with Python 3.9-3.13 to ensure broad compatibility
- Consider using pure Python protobuf implementation as a fallback for better compatibility
Thanks!
Description
Problem:
Despite the attempted fix in commit 0ab4b63, v3io-frames 0.13.8 still fails to work with protobuf 4.x+ versions due to an unresolved _message import
error.
Error:
ImportError: cannot import name '_message' from 'google.protobuf.pyext'
(/path/to/site-packages/google/protobuf/pyext/init.py)
Complete Stack Trace:
File "v3io_frames/init.py", line 26, in
from .grpc import Client as gRPCClient
File "v3io_frames/grpc.py", line 31, in
from .http import format_go_time
File "v3io_frames/http.py", line 32, in
from .pbutils import df2msg, msg2df, pb2py
File "v3io_frames/pbutils.py", line 18, in
from google.protobuf.pyext import cpp_message
File "google/protobuf/pyext/cpp_message.py", line 23, in
from google.protobuf.pyext import _message
ImportError: cannot import name '_message' from 'google.protobuf.pyext'
Environment
Expected Behavior
v3io-frames should work seamlessly with modern protobuf versions (4.x, 5.x, 6.x) as the library doesn't specify version constraints, indicating intended compatibility.
Impact
This compatibility issue:
Root Cause
The protobuf 4.x C++ API changes removed google.protobuf.pyext._message in the same way it was previously available. The fix in commit 0ab4b63 appears to have been incomplete or doesn't cover all code paths.
Reproduction
Current Workaround
Users are forced to implement this monkey patch:
import sys
from unittest.mock import MagicMock
import google.protobuf.pyext
if not hasattr(google.protobuf.pyext, '_message'):
google.protobuf.pyext._message = MagicMock()
if 'google.protobuf.pyext.cpp_message' not in sys.modules:
sys.modules['google.protobuf.pyext.cpp_message'] = MagicMock()
Request
Please:
Thanks!