PySide import error Mac OS X El Capitan, library not loaded: @ rpath / libpyside.cpython-34m.1.2.dylib

ive tried to run an application written on a Linux machine (and works without any problems) on my Mac running OS X El Capitan. the program uses PyQt4 (4.11.4) and PySide (1.2.4), using Python 3.4.2. I created virtualenv to ensure that everything works on the correct version of python. I also have sip. However, when I really try to import something from PySide, it causes the following error:

Traceback (most recent call last): File "GUI.py", line 17, in <module> from PySide import QtCore, QtGui, QtNetwork ImportError: dlopen(/Users/mksmasr/.pyenv/versions/3.4.2/envs/pubdatapy34/lib/python3.4/site-packages/PySide/QtCore.so, 2): Library not loaded: @rpath/libpyside.cpython-34m.1.2.dylib Referenced from: /Users/mksmasr/.pyenv/versions/3.4.2/envs/pubdatapy34/lib/python3.4/site-packages/PySide/QtCore.so Reason: image not found 

I cannot understand the problem even after reading other SO posts and trying to suggest everything.

when I run python on the command line and import PySide, it imports it without problems, there is a problem when trying to access something inside the PySide directory.

ive installed everything from the source, it didn’t work, so I tried pip, the same problem, then I tried homebrew and the same problem. Is compatibility with PySide and python3.x possible?

I would be grateful for any help!

+2
source share
1 answer

I have earned. First by following this topic here

This made it possible to use PySide 1.2.2 or build 1.2.4 from scratch. I settled on 1.2.2:

 pip install -U PySide==1.2.2 

After that, when I tried to import PySide libraries, I got errors complaining about

Insecure use of relative rpath

To fix the ones I followed this advice

In short: I checked the libraries for relative links as follows:

otool -L /Library/Python/2.7/site-packages/PySide/QtCore.so

Then I used install_name_tool -change ... as described in the link above to re-link the two relative libraries there to "/ usr / local / ...". For instance:.

 sudo install_name_tool -change libshiboken-python2.7.1.2.dylib /usr/local/lib/libshiboken-python2.7.1.2.dylib QtCore.so sudo install_name_tool -change libpyside-python2.7.1.2.dylib /usr/local/lib/libpyside-python2.7.1.2.dylib QtCore.so 

Rinse and repeat all .so files. This allowed PySide 1.2.2 to work on El Capitan for me.

+3
source

Source: https://habr.com/ru/post/1262318/


All Articles