Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Unable to Shipping With Python
Forum Updated to NodeBB v4.3 + New Features

Unable to Shipping With Python

Scheduled Pinned Locked Moved Solved Installation and Deployment
12 Posts 2 Posters 2.4k Views 2 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.
  • M Offline
    M Offline
    MemphisWang
    wrote on 7 Mar 2017, 07:20 last edited by MemphisWang 3 Jul 2017, 07:21
    #1

    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 7 Mar 2017, 09:08
    0
    • M MemphisWang
      7 Mar 2017, 07:20

      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 Offline
      M Offline
      MemphisWang
      wrote on 7 Mar 2017, 09:08 last edited by
      #2

      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
      0
      • M Offline
        M Offline
        MemphisWang
        wrote on 7 Mar 2017, 16:13 last edited by
        #3

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

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 7 Mar 2017, 20:34 last edited by
          #4

          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 8 Mar 2017, 02:54
          0
          • S SGaist
            7 Mar 2017, 20:34

            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

            M Offline
            M Offline
            MemphisWang
            wrote on 8 Mar 2017, 02:54 last edited by
            #5

            @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
            0
            • S SGaist
              7 Mar 2017, 20:34

              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

              M Offline
              M Offline
              MemphisWang
              wrote on 8 Mar 2017, 02:58 last edited by
              #6

              @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
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 8 Mar 2017, 07:59 last edited by
                #7

                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
                0
                • M Offline
                  M Offline
                  MemphisWang
                  wrote on 8 Mar 2017, 10:31 last edited by
                  #8

                  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
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 8 Mar 2017, 21:18 last edited by
                    #9

                    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 9 Mar 2017, 02:01
                    0
                    • S SGaist
                      8 Mar 2017, 21:18

                      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.

                      M Offline
                      M Offline
                      MemphisWang
                      wrote on 9 Mar 2017, 02:01 last edited by
                      #10

                      @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
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 9 Mar 2017, 08:06 last edited by
                        #11

                        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 9 Mar 2017, 13:49
                        0
                        • S SGaist
                          9 Mar 2017, 08:06

                          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.

                          M Offline
                          M Offline
                          MemphisWang
                          wrote on 9 Mar 2017, 13:49 last edited by
                          #12

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

                          1 Reply Last reply
                          0

                          1/12

                          7 Mar 2017, 07:20

                          • Login

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