pyzmq: cffi cannot find libzmq.so

I have installing libzmq in /home/ericu/local with the --prefix option on its configure script. Pyzmq installs fine under CPython 2.7.5. It does not work under pypy even with the environmental variables set.

ericu@ubuntu-lts-base:~/fairywren$ LIBRARY_PATH=/home/ericu/local/lib C_INCLUDE_PATH=/home/ericu/local/include pypy -c 'import zmq'
Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "app_main.py", line 566, in run_it
  File "<string>", line 1, in <module>
  File "/home/ericu/pypy-ericu/site-packages/zmq/__init__.py", line 52, in <module>
    from zmq.sugar import backend
  File "/home/ericu/pypy-ericu/site-packages/zmq/sugar/__init__.py", line 16, in <module>
    from zmq.sugar import (
  File "/home/ericu/pypy-ericu/site-packages/zmq/sugar/constants.py", line 16, in <module>
    from .backend import constants
  File "/home/ericu/pypy-ericu/site-packages/zmq/sugar/backend.py", line 29, in <module>
    from zmq.cffi_core import (
  File "/home/ericu/pypy-ericu/site-packages/zmq/cffi_core/__init__.py", line 12, in <module>
    from zmq.cffi_core import (constants, error, message, context, socket,
  File "/home/ericu/pypy-ericu/site-packages/zmq/cffi_core/constants.py", line 4, in <module>
    from ._cffi import C, constant_names, zmq_version_info
  File "/home/ericu/pypy-ericu/site-packages/zmq/cffi_core/_cffi.py", line 195, in <module>
    "Please check that you have zeromq headers and libraries." % e)
ImportError: PyZMQ CFFI backend couldn't find zeromq: cannot load library /home/ericu/pypy-ericu/site-packages/zmq/cffi_core/__pycache__/_cffi__g6ed94bfax67d4e236.pypy-21.so: libzmq.so.3: cannot open shared object file: No such file or directory
Please check that you have zeromq headers and libraries.
ericu@ubuntu-lts-base:~/fairywren$ 

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 26 (13 by maintainers)

Most upvoted comments

It looks like CFFI ignores [DY]LD_LIBRARY_PATH, but respects LIBRARY_PATH.

  • I removed libzmq from my system

  • in libzmq dir (fresh checkout of master): ./configure --prefix=/tmp/libzmq && make && make install

  • pip install pyzmq (gets 13.1.0)

  • pypy -c "import zmq; print zmq.zmq_version()" fails to find zmq.h

    env/pypy-cffi/site-packages/zmq/cffi_core/__pycache__/_cffi__g6ed94bfax67d4e236.c:25:10: fatal error: 'zmq.h' file not found
    #include <zmq.h>
    
  • C_INCLUDE_PATH=/tmp/libzmq/include pypy -c "import zmq; print zmq.zmq_version()" finds zmq.h, fails to link:

    ld: library not found for -lzmq
    
  • adding DYLD_LIBRARY_PATH=/tmp/libzmq/lib changes nothing (makes sense, because it only affects runtime loading, not compilation)

  • LIBRARY_PATH=/tmp/libzmq/lib C_INCLUDE_PATH=/tmp/libzmq/include pypy -c "import zmq; print zmq.zmq_version()" compiles successfully and prints 3.3.0.

This is with pypy-2.1.0 on OS X 10.8.4