Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Unable to Shipping With Python

    Installation and Deployment
    2
    12
    1592
    Loading More Posts
    • 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.
    • M
      MemphisWang last edited by MemphisWang

      Hi all, I'm writing a Qt program with Python embedded. I use the old embed way (python.h, not CFFI).
      It works fine on my creator. But when i try to deploy my program. macdeployqt couldn't help me deploy python.Framework to Frameworks. And the Qt program try to use user's own python environment which is not what i want.
      And Google tells me very little thing about how to deploy python framework when you are embedding it.
      Does anyone try this before? Or Where can i get the right information about how to ship Qt program with python embedded. many thanks

      M 1 Reply Last reply Reply Quote 0
      • M
        MemphisWang @MemphisWang last edited by

        when macdeployqt, it shows this:
        ERROR: no file at "/usr/local/opt/python/lib/Python.framework/Versions/2.7/Python"
        but my python is not here. where should i specific this path for macdeployqt to find Python?

        1 Reply Last reply Reply Quote 0
        • M
          MemphisWang last edited by

          i can only copy python.framework by my self now. still want it processed by macdeployqt automate

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi,

            One thing you can try is to use the -libpath parameter of macdeployqt to give add additional search path that the tool will use to search for libraries/frameworks.

            Hope it helps

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

            M 2 Replies Last reply Reply Quote 0
            • M
              MemphisWang @SGaist last edited by

              @SGaist didn't work.
              BTW, when otool -L my binary

              it shows:

              /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
              /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
              /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1348.28.0)
              @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.8.0, current version 5.8.0)
              @rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.8.0, current version 5.8.0)
              @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.8.0, current version 5.8.0)
              ...
              

              that happened before i use macdeployqt.

              So the path has been set when the binary is created. and macdeployqt copy frameworks according to this. And my Python.Framework is in the wrong place since then.

              1 Reply Last reply Reply Quote 0
              • M
                MemphisWang @SGaist last edited by

                @SGaist For now I have to workaround like this:

                • build my code.
                install_name_tool -change /usr/local/opt/python/Frameworks/Python.framework/Versions/2.7/Python @executable_path/../Frameworks/Python.framework/Versions/2.7/Python
                
                • copy Python.Framework to Frameworks manually

                It works, but I'm not very confident with it.

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  It should be the other way around, copy the framework first and then update the paths inside it. That's basically what macdeployqt does.

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

                  1 Reply Last reply Reply Quote 0
                  • M
                    MemphisWang last edited by

                    Yes, It sounds reasonable that macdeployqt use these shared library information to deploy frameworks.
                    so I take your advice, use install_name_tool to specify my Framework path, try to let macdeployqt to finish the deploy work. And the result is frustrating again:

                    • otool shows it's using:
                    /my_path/.../python/mac/Python.framework/Versions/2.7/Python
                    
                    • macdeployqt try to find in:
                    /my_path/.../python/lib/Python.framework/Versions/2.7/Python
                    

                    T^T ... So werid.

                    after that, i create a link name "lib" and link to "mac", hope it can help macdeployqt to find the right Framework. and it didn't help, the problem stays all the same

                    1 Reply Last reply Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      In that kind of corner cases, the fastest is to write a small script that run macdeployqt on your application bundle, then copy the problematic frameworks and update their paths.

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

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MemphisWang @SGaist last edited by

                        @SGaist Yes that's how i fix it now. maybe macdeployqt is designed to deploy only qt framework. we should do the rest.

                        1 Reply Last reply Reply Quote 0
                        • SGaist
                          SGaist Lifetime Qt Champion last edited by

                          No it's not, however it's easy to be using additional frameworks that may have some quirks once deployed which usually not your fault since you follow their installation instructions.

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

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            MemphisWang @SGaist last edited by

                            @SGaist With this workaround, I should mark this as solved

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post