[zeromq-dev] [python] setuptools, pyzmq and sodium

MinRK benjaminrk at gmail.com
Fri Mar 7 06:07:28 CET 2014

On Thu, Mar 6, 2014 at 11:24 AM, Drew Crawford <drew at sealedabstract.com>wrote:

> Hi folks,
>    1. I’m writing a package
>    2. That I want to distribute with setuptools
>    3. That requires pyzmq
>    4. …to be built with libsodium
> I’m wondering what is the best way to achieve this.  If I simply declare
> in my setup.py
>  install_requires=['pyzmq>=14.0.1’]
> This creates a dependency on pyzmq, however it does not check if it is
> sodium-aware.  And if no pyzmq is present on the system, it installs a
> non-sodium version, so the install is incorrect.
> I see there is some work going on in pyzmq 14.1 to change how libsodium
> packaging works internally  but ideally I am looking for a solution that
> works with 14.0.1.

If it helps, I'm trying to release pyzmq-14.1 in the next week or so. I was
planning to make an RC today or tomorrow. 14.1 will bundle libsodium when
it bundles libzmq. That still doesn't cover the case entirely, because if
pyzmq can find a libzmq on the system, it will link it, even if it doesn't
link libsodium.

Quite simply, setuptools does not have the capacity to express dependencies
on non-Python things.  I see two main choices:

1. check for libsodium in setup.py (zmq.curve_keypair() will fail in the
absence of libsodium), and fail (or warn) manually with a message saying
that they need to rebuild libzmq and/or pyzmq.
2. make the same check at import time. This will be the most visible to

I would recommend #2 because #1 *will not* work if you ever decide to build
wheels, because wheels do not allow you to express any nontrivial logic at
install time.

If you want a command that will guarantee pyzmq with libzmq and libsodium
to include in this message (once I release it), it would be:

    pip install pyzmq>=14.1.0 --install-option="--zmq=bundled"


> Drew
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140306/c0d9b07c/attachment.htm>

More information about the zeromq-dev mailing list