Bugzilla – Bug 1222919
criterion fails to build on Leap 15.6 - ImportError: cannot import name 'builder'
Last modified: 2024-05-23 05:30:49 UTC
Hello package criterion fails to build on Leap 15.6 https://build.opensuse.org/package/live_build_log/openSUSE:Backports:SLE-15-SP6/criterion/standard/x86_64 /home/abuild/rpmbuild/BUILD/Criterion-2.4.2/x86_64-suse-linux/src [ 29s] FAILED: src/criterion.pb.c src/criterion.pb.h [ 29s] /home/abuild/rpmbuild/BUILD/Criterion-2.4.2/src/protocol/gen-pb.py /usr/bin/protoc /usr/bin/protoc-gen-nanopb ../src/protocol/criterion.proto ../src/protocol/criterion.options /home/abuild/rpmbuild/BUILD/Criterion-2.4.2/x86_64-suse-linux/src [ 29s] Traceback (most recent call last): [ 29s] File "/usr/bin/nanopb_generator.py", line 51, in <module> [ 29s] from .proto import nanopb_pb2 [ 29s] ModuleNotFoundError: No module named '__main__.proto'; '__main__' is not a package [ 29s] [ 29s] During handling of the above exception, another exception occurred: [ 29s] [ 29s] Traceback (most recent call last): [ 29s] File "/usr/bin/nanopb_generator.py", line 72, in <module> [ 29s] import proto.nanopb_pb2 as nanopb_pb2 [ 29s] File "/usr/lib/python3.6/site-packages/proto/nanopb_pb2.py", line 9, in <module> [ 29s] from google.protobuf.internal import builder as _builder [ 29s] ImportError: cannot import name 'builder' [ 29s] --nanopb_out: protoc-gen-nanopb: Plugin failed with status code 1. [ 29s] /usr/bin/protoc --plugin=protoc-gen-nanopb=/usr/bin/protoc-gen-nanopb -I../src/protocol --nanopb_out=-f../src/protocol/criterion.options:/home/abuild/rpmbuild/BUILD/Criterion-2.4.2/x86_64-suse-linux/src ../src/protocol/criterion.proto
I did reach out to Paolo over email
The issue seems to be related with Python 3.6 and its deps. We need to use Python 3.11 on Leap in order to get it to work.
We need to update python3-protobuf from 3.9 to 4.25
I give it a try with python311-protobuf-4.25.1 however it failed with different reason https://build.opensuse.org/package/show/home:mlin7442:rebuild_fails_156/criterion
I guess that's because Leap is not using py311 as default (just a guess, I'd have to check), so the following fails: [ 29s] Traceback (most recent call last): [ 29s] File "/usr/bin/nanopb_generator.py", line 36, in <module> [ 29s] import google.protobuf.text_format as text_format [ 29s] ModuleNotFoundError: No module named 'google' [ 29s] --nanopb_out: protoc-gen-nanopb: Plugin failed with status code 1. because /usr/bin/nanopb_generator.py calls python3 and python3 is a symlink to 3.6. Or was the python interpreter changed to 3.11 by default on Leap?
Not changed to 3.11 by default, but 3.11 is 2nd option available other than 3.6. And protobuf 4.25 from SLE15 has built with python 3.11.
Looks like nanopb need to be build with 3.11 as well... Maybe we ran out of time to have a fixed criterion before Leap 15.6 GA, perhaps we have to delete criterion in Leap 15.6, we can revive it with a fixed criterion via maintenance..