tonysimpson / nanomsg-python

nanomsg wrapper for python with multiple backends (CPython and ctypes) should support 2/3 and Pypy
MIT License
381 stars 85 forks source link

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

Open andrewclarkson opened 10 years ago

andrewclarkson commented 10 years ago

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?

tonysimpson commented 10 years ago

Hi Andrew,

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

Thanks.

jordanrinke commented 10 years ago

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

jchedstrom commented 9 years ago

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.

ghost commented 9 years ago

thanks a lot! I was really confused by this.

ptone commented 8 years ago

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

serioustk commented 6 years ago

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.