python import error: cannot open shared object file
<p>My python code gives this error:</p>

<p><code>from cv_bridge import CvBridge, CvBridgeError</code> </p>

<p>ImportError: libcv_bridge.so: cannot open shared object file: No such file or directory.</p>

<p>However if I do a ldd, every thing seems fine. What is wrong?
(ROS indigo, ubuntu 14.04 LTS, PyCharm)</p>

<pre><code>user@user-VirtualBox:/opt/ros/indigo/lib$ ldd libcv_bridge.so
linux-vdso.so.1 =&gt;  (0x00007ffc9439d000)
libopencv_imgproc.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4 (0x00007fcac6b34000)
libopencv_highgui.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4 (0x00007fcac68e9000)
libopencv_core.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4 (0x00007fcac64b1000)
libopencv_contrib.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_contrib.so.2.4 (0x00007fcac61ce000)
libstdc++.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcac5eca000)
libgcc_s.so.1 =&gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcac5cb3000)
libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcac58ee000)
libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcac56d0000)
libtbb.so.2 =&gt; /usr/lib/libtbb.so.2 (0x00007fcac549b000)
libm.so.6 =&gt; /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcac5195000)
libGL.so.1 =&gt; /var/lib/VBoxGuestAdditions/lib/libGL.so.1 (0x00007fcac4f5d000)
libjpeg.so.8 =&gt; /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007fcac4d07000)
libpng12.so.0 =&gt; /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fcac4ae1000)
libtiff.so.5 =&gt; /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007fcac486f000)
libjasper.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libjasper.so.1 (0x00007fcac4617000)
libIlmImf.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libIlmImf.so.6 (0x00007fcac4368000)
libHalf.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libHalf.so.6 (0x00007fcac4125000)
libgtk-x11-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007fcac3ae7000)
libgdk-x11-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007fcac3834000)
libgobject-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fcac35e3000)
libglib-2.0.so.0 =&gt; /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fcac32da000)
libgtkglext-x11-1.0.so.0 =&gt; /usr/lib/libgtkglext-x11-1.0.so.0 (0x00007fcac30d6000)
libgdkglext-x11-1.0.so.0 =&gt; /usr/lib/libgdkglext-x11-1.0.so.0 (0x00007fcac2e72000)
libdc1394.so.22 =&gt; /usr/lib/x86_64-linux-gnu/libdc1394.so.22 (0x00007fcac2bfd000)
libv4l1.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libv4l1.so.0 (0x00007fcac29f7000)
libavcodec.so.54 =&gt; /usr/lib/x86_64-linux-gnu/libavcodec.so.54 (0x00007fcac1ca3000)
libavformat.so.54 =&gt; /usr/lib/x86_64-linux-gnu/libavformat.so.54 (0x00007fcac1980000)
libavutil.so.52 =&gt; /usr/lib/x86_64-linux-gnu/libavutil.so.52 (0x00007fcac175b000)
libswscale.so.2 =&gt; /usr/lib/x86_64-linux-gnu/libswscale.so.2 (0x00007fcac1514000)
libz.so.1 =&gt; /lib/x86_64-linux-gnu/libz.so.1 (0x00007fcac12fa000)
librt.so.1 =&gt; /lib/x86_64-linux-gnu/librt.so.1 (0x00007fcac10f2000)
libopencv_features2d.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_features2d.so.2.4 (0x00007fcac0e4e000)
libopencv_calib3d.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so.2.4 (0x00007fcac0bb8000)
libopencv_ml.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_ml.so.2.4 (0x00007fcac0940000)
libopencv_objdetect.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so.2.4 (0x00007fcac06c5000)
libopencv_video.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_video.so.2.4 (0x00007fcac0471000)
/lib64/ld-linux-x86-64.so.2 (0x0000560365edd000)
VBoxOGLcrutil.so =&gt; /usr/lib/x86_64-linux-gnu/VBoxOGLcrutil.so (0x00007fcac028e000)
libXcomposite.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007fcac008b000)
libXdamage.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fcabfe88000)
libXfixes.so.3 =&gt; /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fcabfc81000)
libXext.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fcabfa6f000)
libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcabf86b000)
liblzma.so.5 =&gt; /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fcabf648000)
libjbig.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007fcabf43a000)
libIex.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libIex.so.6 (0x00007fcabf21c000)
libIlmThread.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libIlmThread.so.6 (0x00007fcabf015000)
libgmodule-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fcabee11000)
libpangocairo-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007fcabec04000)
libX11.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fcabe8ce000)
libatk-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007fcabe6ac000)
libcairo.so.2 =&gt; /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007fcabe3a1000)
libgdk_pixbuf-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007fcabe17f000)
libgio-2.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007fcabde0c000)
libpangoft2-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007fcabdbf7000)
libpango-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007fcabd9a9000)
libfontconfig.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fcabd76d000)
libXrender.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fcabd562000)
libXinerama.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007fcabd35f000)
libXi.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007fcabd14f000)
libXrandr.so.2 =&gt; /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007fcabcf45000)
libXcursor.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007fcabcd3a000)
libffi.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fcabcb32000)
libpcre.so.3 =&gt; /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fcabc8f3000)
libGLU.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libGLU.so.1 (0x00007fcabc685000)
libXmu.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXmu.so.6 (0x00007fcabc46c000)
libpangox-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libpangox-1.0.so.0 (0x00007fcabc24c000)
libraw1394.so.11 =&gt; /usr/lib/x86_64-linux-gnu/libraw1394.so.11 (0x00007fcabc03e000)
libusb-1.0.so.0 =&gt; /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007fcabbe27000)
libv4l2.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libv4l2.so.0 (0x00007fcabbc18000)
libxvidcore.so.4 =&gt; /usr/lib/x86_64-linux-gnu/libxvidcore.so.4 (0x00007fcabb8da000)
libx264.so.142 =&gt; /usr/lib/x86_64-linux-gnu/libx264.so.142 (0x00007fcabb544000)
libvpx.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libvpx.so.1 (0x00007fcabb164000)
libvorbisenc.so.2 =&gt; /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007fcabac95000)
libvorbis.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007fcabaa68000)
libtheoraenc.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007fcaba827000)
libtheoradec.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007fcaba60e000)
libspeex.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libspeex.so.1 (0x00007fcaba3f5000)
libschroedinger-1.0.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libschroedinger-1.0.so.0 (0x00007fcaba130000)
libopus.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libopus.so.0 (0x00007fcab9ee8000)
libopenjpeg.so.2 =&gt; /usr/lib/x86_64-linux-gnu/libopenjpeg.so.2 (0x00007fcab9cc6000)
libmp3lame.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007fcab9a38000)
libgsm.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libgsm.so.1 (0x00007fcab982a000)
libva.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007fcab9614000)
librtmp.so.0 =&gt; /usr/lib/x86_64-linux-gnu/librtmp.so.0 (0x00007fcab93f9000)
libgnutls.so.26 =&gt; /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007fcab913b000)
libbz2.so.1.0 =&gt; /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007fcab8f2b000)
libopencv_flann.so.2.4 =&gt; /usr/lib/x86_64-linux-gnu/libopencv_flann.so.2.4 (0x00007fcab8cc0000)
libfreetype.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fcab8a1c000)
libxcb.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcab87fd000)
libpixman-1.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libpixman-1.so.0 (0x00007fcab8554000)
libxcb-shm.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007fcab8351000)
libxcb-render.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007fcab8148000)
libselinux.so.1 =&gt; /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fcab7f24000)
libresolv.so.2 =&gt; /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fcab7d09000)
libharfbuzz.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007fcab7ab4000)
libthai.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007fcab78aa000)
libexpat.so.1 =&gt; /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fcab7680000)
libXt.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007fcab7419000)
libudev.so.1 =&gt; /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fcab7208000)
libv4lconvert.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libv4lconvert.so.0 (0x00007fcab6f8f000)
libogg.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007fcab6d85000)
liborc-0.4.so.0 =&gt; /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007fcab6b03000)
libgcrypt.so.11 =&gt; /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007fcab6882000)
libtasn1.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007fcab666e000)
libp11-kit.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007fcab642c000)
libXau.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fcab6227000)
libXdmcp.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fcab6021000)
libgraphite2.so.3 =&gt; /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007fcab5dfa000)
libdatrie.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007fcab5bf3000)
libSM.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007fcab59eb000)
libICE.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007fcab57ce000)
libcgmanager.so.0 =&gt; /lib/x86_64-linux-gnu/libcgmanager.so.0 (0x00007fcab55b3000)
libnih.so.1 =&gt; /lib/x86_64-linux-gnu/libnih.so.1 (0x00007fcab539b000)
libnih-dbus.so.1 =&gt; /lib/x86_64-linux-gnu/libnih-dbus.so.1 (0x00007fcab5190000)
libdbus-1.so.3 =&gt; /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fcab4f4b000)
libgpg-error.so.0 =&gt; /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fcab4d45000)
libuuid.so.1 =&gt; /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fcab4b40000)
</code></pre>

<p>You need to export the relevant LD LIBRARY path and add it in your bash profile file as in this example:</p>

<p><a href="http://stackoverflow.com/questions/7880454/python-executable-not-finding-libpython-shared-library">Python executable not finding libpython shared library</a></p>

python ldd