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 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 ” 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:
···
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.
–
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.