nanomsg-python icon indicating copy to clipboard operation
nanomsg-python copied to clipboard

Importing Issues: cannot open shared object file: No such file or directory

Open andrewclarkson opened this issue 12 years ago • 6 comments

I'm hoping this will help others, though I should note this only applies to *nix systems. After building nanomsg from source and installing this package via pip install, I hit a warning and an error when I tried to import.

...
UserWarning: Could not load the default wrapper for your platform: cpy, performance may be affected!
...
OSError: libnanomsg.so: cannot open shared object file: No such file or directory

I figured, I shouldn't get the warning from Cpython, and shouldn't get the error as I did install the library (libnanomsg.so) via sudo make install

After a little digging, I found this question on SO.

I checked out my library linking paths

echo $LD_LIBRARY_PATH

and it was empty. I added a path to where libnanomsg.so installs itself.

export LD_LIBRARY_PATH=/usr/local/lib

and all was well with the world. This is a pretty temporary work around; is there a way we could build the library with the package? maybe use pyzmq as a model?

andrewclarkson avatar Nov 01 '13 18:11 andrewclarkson

Hi Andrew,

I will update the READ.me with some notes on this.

Thanks.

tonysimpson avatar Nov 02 '13 21:11 tonysimpson

Thanks for this, I just had the exact same problem.

jordanrinke avatar Aug 03 '14 19:08 jordanrinke

Even easier you can reboot the system or do the sneaky Linux solution. Just update the system's list of libraries by running "sudo ldconfig". Either way, the system should now be aware of the new library.

jchedstrom avatar Feb 07 '15 19:02 jchedstrom

thanks a lot! I was really confused by this.

ghost avatar Jul 23 '15 10:07 ghost

FWIW - if others hit this on MacOS

homebrew install nanomsg creates a dylib

 cd /usr/local/lib
 ln -s ./libnanomsg.dylib ./libnanomsg.so

In addition to the above env variable fix seems to have gotten this working for me

ptone avatar Sep 26 '16 05:09 ptone

I ran into the same problem. After installing according to readme.md, the error mention by the OP occured. Then I realized that nanomsg works for Python 2.7 but not for Python3 (3.6 to be exact). A simple apt-get install python3-nanomsg did the trick.

serioustk avatar Nov 28 '17 06:11 serioustk