Pyinstall build issues

82 views
Skip to first unread message

Thomas Huffington

unread,
Sep 8, 2016, 7:12:25 PM9/8/16
to wxPython-users
Hi,

I'm having some issues building a standalone app using wxpython 3.0.2.0 with pyinstaller 3.2 on osx 10.11.6, and I was wondering if anyone else has run into the same problem, described in this thread).
Basically every time I try to run the app I get a ton errors followed by a segfault at the point where I declare app = wx.App(false). The thread I linked makes the problem out to be wx libraries, but I can't make head or tails of the workaround (which involves a bunch of library re-linking which I'm not familiar with at all). I've built previous versions of my app before with absolutely no problems, so I was hoping that someone here has seen this before and can help me figure out what's happened to break things.Thanks!

Michael Freeman

unread,
Sep 9, 2016, 11:26:29 AM9/9/16
to wxPython-users
Full output of error messages would be helpful.

Thomas Huffington

unread,
Sep 9, 2016, 12:16:43 PM9/9/16
to wxPython-users
Sure, files linked. I created a very simple hello world program to test, which is where the log comes from, but I get pretty much the same thing when building my app.


2016年9月9日金曜日 8時26分29秒 UTC-7 Michael Freeman:
logfile.txt
helloworld.py

Steve Barnes

unread,
Sep 9, 2016, 12:40:12 PM9/9/16
to wxpytho...@googlegroups.com


On 09/09/2016 17:16, Thomas Huffington wrote:
> Sure, files linked. I created a very simple hello world program to test,
> which is where the log comes from, but I get pretty much the same thing
> when building my app.
>
>
< SNIP >

Thomas,

Looking at your log files pyinstaller is including 2 versions of the wx
libraries, libwx_osx_cocoau_core-3.0.0.2.0.dylib and
libwx_osx_cocoau_core-3.0.0.2.0.dylib and
libwx_osx_cocoau_core-3.0.dylib and for each library call picking one at
random. You ought to be able to specify which one to include/exclude
using Spec files
https://pyinstaller.readthedocs.io/en/stable/spec-files.html and may
also be able to get some help from
https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html.

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

Steve Barnes

unread,
Sep 9, 2016, 12:42:58 PM9/9/16
to wxpytho...@googlegroups.com


On 09/09/2016 17:39, Steve Barnes wrote:
>
>
> On 09/09/2016 17:16, Thomas Huffington wrote:
>> Sure, files linked. I created a very simple hello world program to test,
>> which is where the log comes from, but I get pretty much the same thing
>> when building my app.
>>
>>
> < SNIP >
>
> Thomas,
>
> Looking at your log files pyinstaller is including 2 versions of the wx
> libraries, libwx_osx_cocoau_core-3.0.0.2.0.dylib and
> libwx_osx_cocoau_core-3.0.0.2.0.dylib and
> libwx_osx_cocoau_core-3.0.dylib and for each library call picking one at
> random. You ought to be able to specify which one to include/exclude
> using Spec files
> https://pyinstaller.readthedocs.io/en/stable/spec-files.html and may
> also be able to get some help from
> https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html.
>

Or, of course, if both files are present in your build directory, have a
tidy up. :-)

Thomas Huffington

unread,
Sep 9, 2016, 2:27:54 PM9/9/16
to wxPython-users
I've tried removing the 3.0 libraries from the specfile following this thread, and removing all references to them in all the build files that are created, then rebuilding from the spec file, but that doesn't seem to have done anything. I can't remove the actual library files from the build either, because they're not listed inside the package contents. At this point I think I'm getting away from wxpython and it might be better to post something on the pyinstaller board, but considering that the official response from the bug report thread that I linked earlier is that this is a wx problem, I feel like I might be going in circles...well, probably worth a try anyways. Thanks for your replies!

2016年9月9日金曜日 9時42分58秒 UTC-7 Gadget Steve:

Steve Barnes

unread,
Sep 10, 2016, 2:09:29 AM9/10/16
to wxpytho...@googlegroups.com


On 09/09/2016 19:27, Thomas Huffington wrote:
> I've tried removing the 3.0 libraries from the specfile following this
> thread
> <https://stackoverflow.com/questions/4890159/python-excluding-modules-pyinstaller/17595149#17595149>,
> and removing all references to them in all the build files that are
> created, then rebuilding from the spec file, but that doesn't seem to
> have done anything. I can't remove the actual library files from the
> build either, because they're not listed inside the package contents. At
> this point I think I'm getting away from wxpython and it might be better
> to post something on the pyinstaller board, but considering that the
> official response from the bug report thread that I linked earlier is
> that this is a wx problem, I feel like I might be going in
> circles...well, probably worth a try anyways. Thanks for your replies!
>
Thomas,

Have you looked in your build directory, (and in the sub-directories),
for the presence of the two builds of wxPython? If they are not there
then there will be two on your library path, or a combination of the
two. Making sure that pyInstaller can only "see" one of them by
renaming/moving if they are in the local directory structure or by
temporary modification of the path/system variables, (sorry not an OS-X
expert here), or possibly by Un-installing one and Installing the other
do that there is a single one on your system should resolve the issue.

Thomas Huffington

unread,
Sep 12, 2016, 2:13:13 PM9/12/16
to wxPython-users
Okay, I finally got it working! Just for posterity I'm going to leave the random things I've been documenting over the past three hours or so in this post for posterity/reference.

Just to make sure we're talking about the same thing, the build directory is the folder that pyinstaller creates, right? When I run pyinstaller I get 2 folders, build and dist. build contains a bunch of files that are used during the packing process, but does not contain any dependencies (i.e., library files). dist is where the app/exe reside, but since I'm using pyinstaller's one-file mode, all the library files are packed inside the app so I can't remove them. From what I gather, they are unpacked into a temporary folder at runtime, but of course that doesn't help me with preventing the unwanted files from getting inside the package in the first place. I've already tried uninstalling (using brew) and making sure that weren't somehow two copies of wxpython residing on my system, then reinstalling (again using brew), but the 3.0 libraries still persist after reinstallation, so I think that they come with 3.0.2.0?

Something interesting that I noticed while I was digging around in my wxpython install directory, though, is a python file called wxversion.py that allows you to specify a certain version of wxpython to run. Specifying both 3.0.2.0 and 3.0 worked fine when running the script directly, but after packaging everything up, it apparently couldn't find the wxpython versions that I specified.

I found the libraries in question under /usr/local/Cellar/wxmac/3.0.2_2/lib. What I found was basically a bunch of dylibs, version 3.0.0.2.0, as well as two aliases/symlinks to each individual library, but versioned 3.0 and 3.0.0. I tried simply removing the symlinks, but I got an error as it seems that some wxpython tries to load them instead of going to 3.0.0.2.0 directly. So that was a bust as well.

At this point, now that I'd found what the bug report I linked in my original post was pointing to, I decided to try my luck at following their steps and seeing what the result was. Since the error messages that I was getting only mentioned 2 libraries, libwx_osx_cocoau_core-3.0.dylib and libwx_osx_cocoau_adv-3.0.dylib, I figured that I'd try fixing the references on only those two libraries first.
Running otool -L <libname> let me find whatever references were pointing to /usr/local/Cellar/.../XXX-3.0.0.2.0.dylib, as described in the bug report, and from there I just looked at the manpage for install_name_tool, which got me to "install_name_tool -change /usr/local/Cellar/.../XXX-3.0.0.2.0.dylib /usr/local/opt/wxmac/lib/XXX-3.0.dylib <libname>" to fix all the individual references, after which the pyinstaller package worked! Thanks for sticking with this, I probably would have given up long ago otherwise.

2016年9月9日金曜日 23時09分29秒 UTC-7 Gadget Steve:

Steve Barnes

unread,
Sep 12, 2016, 2:22:59 PM9/12/16
to wxpytho...@googlegroups.com
Good News!

Charlie Winston

unread,
Apr 11, 2017, 11:03:24 AM4/11/17
to wxPython-users
Hi Thomas,
I'm encountering the same problem as you had. 
Can you guide me using a quite detailed steps inorder to solve these reference issues, using install_name_tool?

Thanks in advance!
Reply all
Reply to author
Forward
0 new messages