Search code examples
pythonprotocol-buffersmediapipe

Pyinstaller error: ImportError: cannot import name 'builder' from 'google.protobuf.internal'


Using pyinstaller(Auto-py-to-exe, exactly), I made my python application into exe file. In my application I used mediapipe module and I saw an error saying :

ImportError: cannot import name 'builder' from 'google.protobuf.internal' 

My application worked well in my pycharm environments. I searched web and found that I should downgrade protobuf==3.19.6, where the current version is 4.25.3. But I also saw an error message when I downgraded it,

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mediapipe 0.10.14 requires protobuf<5,>=4.25.3, but you have protobuf 3.19.6 which is incompatible.

Is there any ways to evade this problem? Or should I restart from making exe file with another module, no pyinstaller of auto-py-to-exe ?

*P.S. : I made another simple mediapipe project, which uses mediapipe==0.10.11 and protobuf==3.20.3, and it also worked in pycharm environment and did not work when converted to exe by auto-py-to-exe. I'm quite sure that this is not version issue, but something deeper is required.


Solution

  • I took another way to solve my problem.

    I just used cx_freeze and all went well.