pyzmq icon indicating copy to clipboard operation
pyzmq copied to clipboard

pyinstaller packing zmq error

Open rickyteng opened this issue 7 years ago • 3 comments

Environment:

Windows 2012 Python27 zerorpc (pip install zerorpc, it will install pyzmq, msgpack-python, gevent, future) pyinstaller 3.2.1

Steps: Using pyinstaller pack a py script.

# api.py
# modified from https://www.fyears.org/2017/02/electron-as-gui-of-python-apps-updated.html

from __future__ import print_function

import sys
import zerorpc


class CalcApi(object):

    def calc(self, text):
        """based on the input text, return the int result"""
        try:
            return eval(text)
        except Exception as e:
            return 0.0

    def echo(self, text):
        """echo any text"""
        return text


def parse_port():
    return 4242


def main():
    addr = 'tcp://127.0.0.1:' + str(parse_port())
    s = zerorpc.Server(CalcApi())
    s.bind(addr)
    print('start running on {}'.format(addr))
    s.run()

if __name__ == '__main__':
    main()

packing command

pyinstaller api.py

Error:

4736 INFO: Looking for dynamic libraries
5439 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\message.pyd
5532 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_device.pyd
5641 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\utils.pyd
5735 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\socket.pyd
5844 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_poll.pyd
5937 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\context.pyd
6031 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\error.pyd
6125 WARNING: lib not found: libzmq.pyd dependency of c:\python27\lib\site-packa
ges\zmq\backend\cython\_version.pyd

Solution:

I found libzmq.pyd located C:\Python27\Lib\site-packages\zmq. I copied it to C:\Python27\Lib\site-packages\zmq\backend\cython. Re-run pyinstaller.

rickyteng avatar Mar 24 '17 02:03 rickyteng

Thanks rickyteng! Saved me quite a bit a time with this fix!

panamajoecu avatar Apr 11 '17 09:04 panamajoecu

Actually, the current Pyinstaller with Python 3.6 on Windows 10 still have the same problem. The solution is still the same: copy libzmq.pyd from Python folder to zmq\backend\cython folder.

glucee avatar Aug 09 '18 08:08 glucee

Anyone care to share their pyinstaller spec file?

kitattyor avatar Dec 20 '19 09:12 kitattyor

Closing as old and not really a pyzmq issue. I also suspect that pyzmq 26, which has a single library that statically links libzmq on Windows will also not see this issue.

minrk avatar Feb 28 '24 11:02 minrk