New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyinstaller pack zmq error #1105

Open
friddle opened this Issue Nov 3, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@friddle

friddle commented Nov 3, 2017

https://github.com/zeromq/pyzmq/blob/master/zmq/__init__.py

when i use pyinstaller to pack my source and I found this problem.
image
And I debug I found that

    try:
        from . import libzmq
    except ImportError:
        pass

In pyinstaller,import error when i execute the pyinstaller executable file.
os.getcwd() is to my execute location,not include libzmq.so。
when I change the location to the folder where include libzmq.so..I could not import libzmq.so ethir
when I copy libzmq.so to excutable root folder and import again.
it is ok,but stranger
this is fix code

     try:
        from . import libzmq
    except ImportError as e:
        #for compatiable pyinstaller runner
        import os;os.chdir(os.path.join(os.path.dirname(__file__),"../"))
        import shutil;
        if os.path.exists("./zmq/libzmq.so"): shutil.copy('./zmq/libzmq.so','./');
        import libzmq

please fix this problem.

other information
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
pyinstaller 3.3
Darwin sckMacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
zmq:0.0.0

@friddle friddle changed the title from pyinstaller pack qmz error to pyinstaller pack zmq error Nov 3, 2017

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Nov 3, 2017

Member

Is the libzmq.so included in the bundle, just not loaded?

Member

minrk commented Nov 3, 2017

Is the libzmq.so included in the bundle, just not loaded?

@friddle

This comment has been minimized.

Show comment
Hide comment
@friddle

friddle Nov 4, 2017

Thanks for answer me.
Forgive my poor english.
I try pack using Pyinstaller in Linux is ok.failed in mac

In mac folder like(I have left my mac in offices,so i draw it)
[executable_folder]
----zmq
-----[libzmq.so]
-----zmq
-------[backend]
-------[python]
----[zmq.backend.*]
And when I debug .it into the zmq folder to import libzmq.so.but failed

I check it in Ubuntu.libzmq.so not in sub folder.so it work ok
image

thanks。

friddle commented Nov 4, 2017

Thanks for answer me.
Forgive my poor english.
I try pack using Pyinstaller in Linux is ok.failed in mac

In mac folder like(I have left my mac in offices,so i draw it)
[executable_folder]
----zmq
-----[libzmq.so]
-----zmq
-------[backend]
-------[python]
----[zmq.backend.*]
And when I debug .it into the zmq folder to import libzmq.so.but failed

I check it in Ubuntu.libzmq.so not in sub folder.so it work ok
image

thanks。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment