Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1242

When bundling app on macOS, shiboken2 leads to rpath issues

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.14.1
    • PySide, Shiboken
    • None
    • macOS 10.15.3, Python 3.7.6 , PySide2/shiboken3  5.14.1, venv
    • macOS

    Description

      Hi, 

      I've built an app on macOS 10.15.3, using Python 3.7.6 and PySide2 5.14.1.

       

      Lately, I tried to bundle it to be able to deploy it to other Macs. 

      To do so, I followed [this page|https://www.metachris.com/2015/11/create-standalone-mac-os-x-applications-with-python-and-py2app/] but using [this repo|https://github.com/ronaldoussoren/py2app.git@master|git+https://github.com/ronaldoussoren/py2app.git@master]

       

      To sum up, in my project folder, I ran:

      pip3 install --user pipenv
      virtualenv venv
      . venv/bin/activate
      pip install -U git+https://github.com/ronaldoussoren/py2app.git@master
      pipenv install PySide2
      py2applet --make-setup main.py
      python setup.py py2app -A
      

      This last command allows to create a running app based on local sources.

       

      The next step is to create an actual portable app by typing this command: 

      python setup.py py2app
      

       

      It runs perfectly but when I try to start my app, I end up with the following error: 

      $ ./dist/main.app/Contents/MacOS/main
      PySide2/__init__.py: Unable to import shiboken2 from /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python37.zip, /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7, /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/lib-dynload, /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/site-packages.zip, /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/site-packages
      Traceback (most recent call last):
        File "/Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/__boot__.py", line 101, in <module>
          _run()
        File "/Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/__boot__.py", line 84, in _run
          exec(compile(source, path, "exec"), globals(), globals())
        File "/Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/main.py", line 7, in <module>
          from PySide2.QtCore import Qt, QUrl, QFile, QIODevice, QTextStream, QDataStream
        File "PySide2/__init__.pyc", line 61, in <module>
        File "PySide2/__init__.pyc", line 25, in _setupQtDirectories
        File "shiboken2/__init__.pyc", line 27, in <module>
        File "shiboken2/shiboken2.pyc", line 14, in <module>
        File "shiboken2/shiboken2.pyc", line 10, in __load
        File "imp.pyc", line 342, in load_dynamic
      ImportError: dlopen(/Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/lib-dynload/shiboken2/shiboken2.so, 2): Library not loaded: @rpath/libshiboken2.abi3.5.14.dylib
        Referenced from: /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/lib-dynload/shiboken2/shiboken2.so
        Reason: image not found
      2020-03-10 15:32:54.204 main[55568:1654766] main Error
      

      The first line says that it's unable to import shiboken2 from a list of paths. Among them, 

      /Users/myUser/Documents/Dev/Annotator/dist/main.app/Contents/Resources/lib/python3.7/lib-dynload

      which contains a 'shiboken2' folder containing 'shiboken2.so'. I even created a simlink in 'lib-dynload' pointing at 'shiboken2/shiboken.so' and restarted the app but it still doesn't work.

       

      Am I missing something here? 

       

      Thanks a  lot for your help

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            hubchau Hubert Chauvat
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes