[IPython-dev] Qt/Curses interfaces future: results of the weekend mini-sprint (or having fun with 0mq)

Darren Dale dsdale24@gmail....
Tue Mar 23 20:11:05 CDT 2010


On Tue, Mar 23, 2010 at 7:43 PM, Brian Granger <ellisonbg@gmail.com> wrote:
> Darren,
>
>> This sounds really exciting. I am having some trouble installing pyzmq:
>
> OK, let's get this figured out.  Should be simple.
>
>> On Tue, Mar 23, 2010 at 5:01 PM, Fernando Perez <fperez.net@gmail.com> wrote:
>>> git://github.com/sustrik/zeromq2.git
>>>
>>> then run
>>>
>>> ./autogen.sh
>>> ./configure --prefix=your_favorite_installation_prefix
>>> make
>>> make install
>>>
>>> This should give you a fully working 0mq.
>>
>> I used --prefix=/usr/local
>>
>>> Then for the python
>>> bindings, clone Brian's repo and get the kernel branch:
>>>
>>> git clone git://github.com/ellisonbg/pyzmq.git
>>> cd pyzmq
>>> git co -b kernel origin/kernel
>>>
>>> then
>>>
>>> cp setup.cfg.template setup.cfg
>>>
>>> and edit setup.cfg to indicate where you put your libraries.  This is
>>> basically the prefix above with /lib and /include appended.
>>
>> [build_ext]
>> # Edit these to point to your installed zeromq library and header dirs.
>> library_dirs = /usr/local/lib
>> include_dirs = /usr/local/include
>>
>> I checked that libzmq.so* exist in /usr/local/lib, same for zmq.* in
>> /usr/local/include
>>
>>> Then you can do the usual
>>>
>>> python setup.py install --prefix=your_favorite_installation_prefix
>>
>> First I did "python setup.py build":
>>
>> running build
>> running build_py
>> creating build
>> creating build/lib.linux-x86_64-2.6
>> creating build/lib.linux-x86_64-2.6/zmq
>> copying zmq/__init__.py -> build/lib.linux-x86_64-2.6/zmq
>> running build_ext
>> building 'zmq._zmq' extension
>> creating build/temp.linux-x86_64-2.6
>> creating build/temp.linux-x86_64-2.6/zmq
>> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>> -Wstrict-prototypes -fPIC -I/usr/local/include
>> -I/usr/include/python2.6 -c zmq/_zmq.c -o
>> build/temp.linux-x86_64-2.6/zmq/_zmq.o
>> gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
>> build/temp.linux-x86_64-2.6/zmq/_zmq.o -L/usr/local/lib -lzmq -o
>> build/lib.linux-x86_64-2.6/zmq/_zmq.so
>>
>> Next I used "python setup.py install --user" (which is equivalent to
>> "--prefix=~/.local"):
>>
>> running install
>> running build
>> running build_py
>> running build_ext
>> running install_lib
>> copying build/lib.linux-x86_64-2.6/zmq/_zmq.so ->
>> /home/darren/.local/lib/python2.6/site-packages/zmq
>> running install_egg_info
>> Removing /home/darren/.local/lib/python2.6/site-packages/pyzmq-0.1.egg-info
>> Writing /home/darren/.local/lib/python2.6/site-packages/pyzmq-0.1.egg-info
>>
>>> The prototype we wrote lives in examples/kernel.  To play with it,
>>> open 3 terminals:
>>>
>>> - T1: run kernel.py, just leave it there.
>>
>> Here is where I run into trouble:
>>
>> Traceback (most recent call last):
>>  File "kernel.py", line 21, in <module>
>>    import zmq
>>  File "/home/darren/.local/lib/python2.6/site-packages/zmq/__init__.py",
>> line 26, in <module>
>>    from zmq import _zmq
>> ImportError: libzmq.so.0: cannot open shared object file: No such file
>> or directory
>
> We link to libzmq.so dynamically so on Linux you have to set
> LD_LIBRARY_PATH to point to /usr/local/lib.  Let me know if that
> doesn't help.  I am also on #ipython right now.

I had a look at h5py's setup.py, and discovered that Andrew was
passing a runtime_library_dirs kwarg to Extension(). This diff seems
to fix the problem in my particular case:

diff --git a/setup.py b/setup.py
index 86283c6..dc38454 100644
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,8 @@ else:
 zmq = Extension(
     'zmq._zmq',
     sources = [zmq_source],
-    libraries = [libzmq]
+    libraries = [libzmq],
+    runtime_library_dirs = ['/usr/local/lib'],
 )

Darren


More information about the IPython-dev mailing list