11

while trying just to import

from PySide import QtGui

I'm getting the following error:

ImportError: libpyside-python2.7.so.1.2: cannot open shared object file: No such file or directory

ls /usr/local/lib/python2.7/dist-packages/PySide/libpyside-python2.7.so.1.2

/usr/local/lib/python2.7/dist-packages/PySide/libpyside-python2.7.so.1.2

So the so file is in place, why PySide cannot find it? I've tried to install PySide via pip but got some kind of post-processing script error and installed package through synaptic.

Additional information:

ldd /usr/local/lib/python2.7/dist-packages/PySide/libpyside-python2.7.so.1.2
        linux-vdso.so.1 =>  (0x00007ffffd34e000)
        libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007fdd5a6ae000)
        libshiboken-python2.7.so.1.2 => not found
        libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007fdd5a1d6000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fdd59ed3000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fdd59cbd000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdd598f4000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fdd596dd000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdd594c0000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdd592bb000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fdd590b8000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdd58db3000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fdd58ab6000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fdd588ae000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fdd5ae32000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fdd5866e000)
Moonwalker
  • 2,180
  • 1
  • 29
  • 48
  • what does `ldd /usr/local/lib/python2.7/dist-packages/PySide/libpyside-python2.7.so.1.2` say? – mata Aug 22 '13 at 00:07
  • 1
    please can you describe how did you install pyside ? did you use pyside-setup to build pyside if yes, did you run "pyside_postistall -install" command ? did you follow the install instructions here https://pypi.python.org/pypi/PySide#building-pyside-on-a-unix-system-ubuntu-12-04-lts ? – rlacko Aug 22 '13 at 07:11
  • @mata I've updated the post with relevant information. – Moonwalker Aug 22 '13 at 08:00
  • @rlacko I got problems with pip and installed package from repository with synaptic. – Moonwalker Aug 22 '13 at 08:02
  • @rlacko then I try to follow the instractions on python2.7 setup.py bdist_egg --version=1.2.1 step it says #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE." – Moonwalker Aug 22 '13 at 08:09
  • by default ubuntu 13.04 has only qt5 installed. pyside needs qt4. did you install qt4 packages ? also try to set the path to qmake with --qmake parameter: python setup.py bdist_egg --qmake=/usr/bin/qmake-qt4 --version=1.2.1. Please see this for details: http://stackoverflow.com/questions/16074801/pyside-install-fails-python-2-7-4 – rlacko Aug 22 '13 at 08:47
  • The problem seems to be that `libshiboken-python2.7.so.1.2` isn't found. Try to locate it on your system, it needs to be somewhere the [dynamic linker](http://linux.die.net/man/8/ld-linux) can find it. – mata Aug 22 '13 at 09:52
  • @mata locate libshiboken-python2.7.so.1.2 /usr/local/lib/python2.7/dist-packages/PySide/libshiboken-python2.7.so.1.2 /usr/local/lib/python2.7/dist-packages/PySide/libshiboken-python2.7.so.1.2.1 it seems libshiboken is on system path. I don't know that's wrong... – Moonwalker Aug 22 '13 at 12:44

2 Answers2

18

The output of ldd suggests that libshiboken-python2.7.so.1.2 can't be found.

/usr/local/lib/python2.7/dist-packages/PySide, where it is found, is not typically a directory where the dynamic linker would look for it.

There are several options in this case:

  • add the directory to the directories checked by the dynamic linker.

    To do so, you can create a configuration file, e.g. /etc/ld.so.conf.d/pyside.conf with the content:

    /usr/local/lib/python2.7/dist-packages/PySide
    

    then as root run ldconfig

  • copy or symlink the library to a directory that is already checked by the dynamic linker, like /usr/local/lib (and run ldconfig as root)

  • set LD_LIBRARY_PATH=/usr/local/lib/python2.7/dist-packages/PySide (not reccomended)

mata
  • 67,110
  • 10
  • 163
  • 162
  • the pyside_postinstall script updates the RPATH in pyside libs so the ldd first looks into /usr/local/lib/python2.7/dist-packages/PySide dir for dependent libs. this is why i recommended you to run it in first place so you dont have to manually run ldconfig – rlacko Aug 22 '13 at 17:20
  • Can you send me what have you done, so I can fix the bugs and update the documentation ? ideal would be the build output from console. thanks – rlacko Aug 22 '13 at 18:54
1

If you have used pyside-setup to build from source, just run

sudo python pyside_postinstall.py -install
Francesco
  • 3,200
  • 1
  • 34
  • 46
kdinakar
  • 11
  • 1