During py2exe build I get the following error:
creating python loader for extension 'win32clipboard' (C:\Python27\lib\site-packages\win32\win32clipboard.pyd -> win32clipboard.pyd)
creating python loader for extension '_rl_accel' (C:\Python27\lib\site-packages\_rl_accel.pyd -> _rl_accel.pyd)
*** finding dlls needed ***
error: libzmq.pyd: No such file or directory
Can anyone explain if I really need it, where to find it or how to exclude it.
Thanks Mads
Three steps are necessary to make it work:
libzmq.pyd
from dlls with dll_excludes
option. This avoids "missing pyzmq.pyd" errors.zmq.libzmq
(same thing) from modules with excludes
. This skips the usual .pyd renamind and proxying that py2exe does.zmq.backend.cython
explicitly with includes
option, because py2exe can't see it through pyzmq backend selection code. You will get "no module named cffi" errors if you fail to do that.Example:
import zmq.libzmq
setup(
# ...
zipfile='lib/library.zip',
options={
'py2exe': {
'includes': ['zmq.backend.cython'],
'excludes': ['zmq.libzmq'],
'dll_excludes': ['libzmq.pyd'],
}
},
data_files=[
('lib', (zmq.libzmq.__file__,))
]
)
Unfortunately this isn't a nice answer, but I think it is a decent diagnosis.
The py2exe wiki is not up to date (at least I think). I believe that version 13.0.0 made a change in which libzmq.pyd replaces libzmq.dll. Py2exe's normal handling of extension modules renames this to "zmq.libzmq.pyd", but that breaks the windows dll finding since (for example) zmq.core._device.pyd links explicitly to libzmq.pyd.
This motivates an alternative ugly fix of copying zmq.libzmq.pyd to libzmq.pyd in the dist folder generated by py2exe. With this fix, my py2exe output exe runs correctly with-out import errors.
I am not sure that this is an optimal solution but it worked for me:
Mads
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With