{"id":893,"date":"2016-10-20T21:10:08","date_gmt":"2016-10-20T19:10:08","guid":{"rendered":"http:\/\/ndk.sytes.net\/wordpress\/?p=893"},"modified":"2016-10-20T21:10:08","modified_gmt":"2016-10-20T19:10:08","slug":"fixing-pyinstaller-on-osx-when-using-pyside","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=893","title":{"rendered":"Fixing PyInstaller on OSX when using PySide"},"content":{"rendered":"<p>\n\tWhen using PyInstaller to package my PySide application &nbsp;i had following errors in the command-line:\n<\/p>\n<pre>\n3513 INFO: Looking for dynamic libraries\n3663 ERROR: Can not find path .\/libpyside-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtGui.so)\n3664 ERROR: Can not find path .\/libshiboken-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtGui.so)\n3670 ERROR: Can not find path .\/libpyside-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtNetwork.so)\n3670 ERROR: Can not find path .\/libshiboken-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtNetwork.so)\n3680 ERROR: Can not find path .\/libpyside-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtCore.so)\n3680 ERROR: Can not find path .\/libshiboken-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtCore.so)<\/pre>\n<p>\n\tMy application did start on my own machine but not on others where PySide was not installed. Here is a simple fix which worked for me to get my app running on another mac:\n<\/p>\n<p>\n\tOpen following file:\n<\/p>\n<pre>\n\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PyInstaller\/depend\/bindepend.py<\/pre>\n<p>\n\tand look for the function&nbsp;_getImports_macholib()&#8230; inside that function find following loop:\n<\/p>\n<pre>\n# Try multiple locations.\nfor run_path in run_paths:\n    # @rpath may contain relative value. Use exec_path as\n    # base path.\n    if not os.path.isabs(run_path):\n        run_path = os.path.join(exec_path, run_path)\n    # Stop looking for lib when found in first location.\n    if os.path.exists(os.path.join(run_path, lib)):\n        final_lib = os.path.abspath(os.path.join(run_path, lib))\n        rslt.add(final_lib)\n        break<\/pre>\n<p>\n\tand change the loop to\n<\/p>\n<pre>\n# Try multiple locations.\nfor run_path in run_paths:\n    # @rpath may contain relative value. Use exec_path as\n    # base path.\n    if not os.path.isabs(run_path):\n        run_path = os.path.join(exec_path, run_path)\n    # Fix path problems for PySide install on OSX\n    if &quot;PySide&quot; in run_path:\n        run_path = run_path.replace(&quot;..\/..\/..\/&quot;, &quot;&quot;) \n    # Stop looking for lib when found in first location.\n    if os.path.exists(os.path.join(run_path, lib)):\n        final_lib = os.path.abspath(os.path.join(run_path, lib))\n        rslt.add(final_lib)\n        break<\/pre>\n<p>\n\tThat&#39;s it, save the file and package your app. For me that fixed all other errors.\n<\/p>\n<p>\n\tHere my setup when fixing: PySide 1.2.4 (PyPi), Qt 4.8.7 (stock binary), Python 2.7.12, PyInstaller 3.3-dev\n<\/p>\n<p>\n\tHappy coding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When using PyInstaller to package my PySide application &nbsp;i had following errors in the command-line: 3513 INFO: Looking for dynamic libraries 3663 ERROR: Can not find path .\/libpyside-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtGui.so) 3664 ERROR: Can not find path .\/libshiboken-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtGui.so) 3670 ERROR: Can not find path .\/libpyside-python2.7.1.2.dylib (needed by \/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/PySide\/QtNetwork.so) 3670 ERROR: Can not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4],"tags":[],"class_list":["post-893","post","type-post","status-publish","format-standard","hentry","category-mac-osx","category-programming"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=893"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/893\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}