Bug 1222919

Summary: criterion fails to build on Leap 15.6 - ImportError: cannot import name 'builder'
Product: [openSUSE] openSUSE Distribution Reporter: Lubos Kocman <lubos.kocman>
Component: OtherAssignee: Paolo Stivanin <pstivanin>
Status: IN_PROGRESS --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: mlin, pstivanin
Version: Leap 15.6   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Lubos Kocman 2024-04-16 21:42:44 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
Comment 1 Lubos Kocman 2024-04-16 21:47:04 UTC
I did reach out to Paolo over email
Comment 2 Paolo Stivanin 2024-04-17 07:51:44 UTC
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.
Comment 3 Paolo Stivanin 2024-04-17 07:57:48 UTC
We need to update python3-protobuf from 3.9 to 4.25
Comment 4 Max Lin 2024-05-06 08:42:10 UTC
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
Comment 6 Paolo Stivanin 2024-05-22 13:14:19 UTC
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?
Comment 7 Max Lin 2024-05-23 05:09:15 UTC
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.
Comment 8 Max Lin 2024-05-23 05:30:49 UTC
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..