Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Generate binary file with pyinstaller
Forum Updated to NodeBB v4.3 + New Features

Generate binary file with pyinstaller

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 2 Posters 982 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    Xav12358
    wrote on last edited by
    #1

    Hello,

    I try to generate a binary file with pyinstaller. I have a program using PySide2.
    I generate my binary with

    pyinstaller  --onefile main.py -y
    

    When I run the generated binary file, I get that error:

    Traceback (most recent call last):
      File "main.py", line 4, in <module>
        from PySide2.QtWidgets import QApplication, QMainWindow
    ImportError: /tmp/_MEIA5cWN3/libQt5Widgets.so.5: undefined symbol: _ZN9QFileInfo4statEv, version Qt_5
    [67652] Failed to execute script 'main' due to unhandled exception!
    
    1 Reply Last reply
    0
    • SGaistS SGaist

      Can you try with conda ? If memory serves well, they should pull the same Qt version in.

      X Offline
      X Offline
      Xav12358
      wrote on last edited by
      #12

      @SGaist I have the same trouble.

      According to that documentation, pyinstaller use the system environment to build the binary file:
      https://doc.qt.io/qtforpython-5/deployment-pyinstaller.html

      So if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.

      SGaistS 1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        How did you install PySide2 ?
        Are you sure pyinstaller is using the correct Qt version to create the package ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        X 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          How did you install PySide2 ?
          Are you sure pyinstaller is using the correct Qt version to create the package ?

          X Offline
          X Offline
          Xav12358
          wrote on last edited by
          #3

          @SGaist I use pip to install Pyside2.

          How could I specify the version of Qt on pyinstaller?

          The command I used is the one in the first post.

          SGaistS 1 Reply Last reply
          0
          • X Xav12358

            @SGaist I use pip to install Pyside2.

            How could I specify the version of Qt on pyinstaller?

            The command I used is the one in the first post.

            SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Did you create a virtual environment ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            X 1 Reply Last reply
            0
            • SGaistS SGaist

              Did you create a virtual environment ?

              X Offline
              X Offline
              Xav12358
              wrote on last edited by
              #5

              @SGaist no I use my system environment

              SGaistS 1 Reply Last reply
              0
              • X Xav12358

                @SGaist no I use my system environment

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #6

                I would rather do that in a dedicated environment to keep everything cleanly separated.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                X 1 Reply Last reply
                0
                • SGaistS SGaist

                  I would rather do that in a dedicated environment to keep everything cleanly separated.

                  X Offline
                  X Offline
                  Xav12358
                  wrote on last edited by Xav12358
                  #7

                  @SGaist I generate a virtuel environment

                  I still use that command to generate the installer:

                  pyinstaller  --onefile main.py -y
                  

                  I get that error when I run ./dist/main

                  Traceback (most recent call last):
                    File "main.py", line 4, in <module>
                      from PySide2.QtWidgets import QApplication, QMainWindow
                  ImportError: could not import module 'PySide2.QtGui'
                  [154703] Failed to execute script 'main' due to unhandled exception!
                  
                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    Xav12358
                    wrote on last edited by
                    #8

                    In fact, I think I find the trouble. I include matplotlib and Pyside2

                    One is Using Qt5.15.0 and the other Qt5.15.2.

                    How can I manage to use Matplotlib and PySide2 with the same Qt library version?

                    How can I know with Qt version matplotlib use and also Pyside. I would like to specify the version of both library to avoid the trouble

                    SGaistS 1 Reply Last reply
                    0
                    • X Xav12358

                      In fact, I think I find the trouble. I include matplotlib and Pyside2

                      One is Using Qt5.15.0 and the other Qt5.15.2.

                      How can I manage to use Matplotlib and PySide2 with the same Qt library version?

                      How can I know with Qt version matplotlib use and also Pyside. I would like to specify the version of both library to avoid the trouble

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      How did you install matplotlib ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      X 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        How did you install matplotlib ?

                        X Offline
                        X Offline
                        Xav12358
                        wrote on last edited by
                        #10

                        @SGaist I also use pip

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11

                          Can you try with conda ? If memory serves well, they should pull the same Qt version in.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          X 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Can you try with conda ? If memory serves well, they should pull the same Qt version in.

                            X Offline
                            X Offline
                            Xav12358
                            wrote on last edited by
                            #12

                            @SGaist I have the same trouble.

                            According to that documentation, pyinstaller use the system environment to build the binary file:
                            https://doc.qt.io/qtforpython-5/deployment-pyinstaller.html

                            So if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.

                            SGaistS 1 Reply Last reply
                            0
                            • X Xav12358

                              @SGaist I have the same trouble.

                              According to that documentation, pyinstaller use the system environment to build the binary file:
                              https://doc.qt.io/qtforpython-5/deployment-pyinstaller.html

                              So if I use Conda, Virtual Env, it will alway use the systm environment to generate the binary.

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #13

                              Then clean your system Python and work exclusively from the virtual environment.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              X 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Then clean your system Python and work exclusively from the virtual environment.

                                X Offline
                                X Offline
                                Xav12358
                                wrote on last edited by
                                #14

                                @SGaist I clean it and I looked at the python package version. I notice that the PySide version installed was the 5.15.2 and the matplot uses the 5.15.0. I modify the PySide versin and now the package are compatible.

                                1 Reply Last reply
                                0
                                • X Xav12358 has marked this topic as solved on

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved