[PyInstaller] pyenchant/Mac OS the adventure continues

78 views
Skip to first unread message

David Cortesi

unread,
Nov 10, 2011, 10:50:44 PM11/10/11
to pyins...@googlegroups.com
The symptom has changed - suddenly (and I swear I didn't change the spec file) the error is no longer "enchant C library not found," it has become the following, I show the full debug output because it seems to show the bundled app executing code out of the pyinstaller's folder and the build folder and also out of the installed enchant egg -- rather than being confined to the bundle.

Last login: Thu Nov 10 19:27:16 on ttys001
/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PPQT ; exit;
[19:38 ~] /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PPQT ; exit;
thisfile is /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PPQT
homepath is /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/
_MEIPASS2 is NULL
Extracting binaries
Executing self as child with /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/
/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/
thisfile is /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PPQT
homepath is /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/
_MEIPASS2 is /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/
Already in the child - running!
/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/Python
Manipulating evironment
PYTHONPATH=/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT
v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
import encodings # directory /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings
# /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/__init__.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/__init__.py
import encodings # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/__init__.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/codecs.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/codecs.py
import codecs # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/codecs.pyc
import _codecs # builtin
# /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/aliases.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/aliases.py
import encodings.aliases # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/aliases.pyc
# /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/latin_1.pyc matches /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/latin_1.py
import encodings.latin_1 # precompiled from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings/latin_1.pyc
importing modules from CArchive
import marshal # builtin
extracted iu
import imp # builtin
import posix # builtin
extracted struct
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_struct.so", 2);
import _struct # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_struct.so
extracted archive
Installing import hooks
outPYZ1.pyz
Running scripts
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/zlib.so", 2);
import zlib # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/zlib.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/future_builtins.so", 2);
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/itertools.so", 2);
import itertools # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/itertools.so
import future_builtins # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/future_builtins.so
import _sre # builtin
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/strop.so", 2);
import strop # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/strop.so
import errno # builtin
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PyQt4.QtCore.so", 2);
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/sip.so", 2);
import sip # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/sip.so
import PyQt4.QtCore # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PyQt4.QtCore.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PyQt4.QtGui.so", 2);
import PyQt4.QtGui # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PyQt4.QtGui.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_bisect.so", 2);
import _bisect # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_bisect.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_socket.so", 2);
import _socket # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_socket.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_ssl.so", 2);
import _ssl # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_ssl.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/cStringIO.so", 2);
import cStringIO # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/cStringIO.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/time.so", 2);
import time # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/time.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_collections.so", 2);
import _collections # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_collections.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/operator.so", 2);
import operator # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/operator.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/binascii.so", 2);
import binascii # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/binascii.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_ctypes.so", 2);
import _ctypes # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_ctypes.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_functools.so", 2);
import _functools # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_functools.so
dlopen("/Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_locale.so", 2);
import _locale # dynamically loaded from /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/_locale.so
!!!DARWIN
!!! GOT /Library/Python/2.6/site-packages/pyenchant-1.6.5-py2.6-macosx-10.4-universal.egg/enchant/lib/libenchant.1.dylib
Traceback (most recent call last):
  File "<string>", line 297, in <module>
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 424, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 514, in doimport
    exec co in mod.__dict__
  File "/Users/original/Dropbox/David/PPQT/ppqt-mac/build/pyi.darwin/ppqt-nobundle/outPYZ1.pyz/pqSpell", line 48, in <module>
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 424, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 514, in doimport
    exec co in mod.__dict__
  File "/Users/original/Dropbox/David/PPQT/ppqt-mac/build/pyi.darwin/ppqt-nobundle/outPYZ1.pyz/enchant", line 90, in <module>
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 465, in importHook
    mod = self.doimport(nm, ctx, ctx+'.'+nm)
  File "/Users/original/Dropbox/David/PPQT/pyinstaller-r1655/PyInstaller/iu.py", line 514, in doimport
    exec co in mod.__dict__
  File "/Library/Python/2.6/site-packages/pyenchant-1.6.5-py2.6-macosx-10.4-universal.egg/enchant/_enchant.py", line 113, in <module>
    e = CDLL(e_path)
  File "/Users/original/Dropbox/David/PPQT/ppqt-mac/build/pyi.darwin/ppqt-nobundle/outPYZ1.pyz/ctypes", line 345, in __init__
OSError: dlopen(/Library/Python/2.6/site-packages/pyenchant-1.6.5-py2.6-macosx-10.4-universal.egg/enchant/lib/libenchant.1.dylib, 6): Library not loaded: @loader_path/libgmodule-2.0.0.dylib
  Referenced from: /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT//libenchant.1.dylib
  Reason: image not found
RC: -1 from ppqt
OK.
Back to parent...
Freeing status for /Users/original/Dropbox/David/PPQT/ppqt-mac/dist/PPQT/PPQT
logout

[Process completed]




Hartmut Goebel

unread,
Nov 11, 2011, 4:06:50 AM11/11/11
to pyins...@googlegroups.com
Am 11.11.2011 04:50, schrieb David Cortesi:
The symptom has changed - suddenly (and I swear I didn't change the spec file) the error is no longer "enchant C library not found," it has become the following, I show the full debug output because it seems to show the bundled app executing code out of the pyinstaller's folder and the build folder and also out of the installed enchant egg -- rather than being confined to the bundle.

I don't have time to digg into this today, but it looks like sys.path is mixed up:


import encodings # directory /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/encodings

This must not come from the framework. It seams to be a severe problem. Please try a very simple script which only prints sys.path.

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult 
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de

David Cortesi

unread,
Nov 11, 2011, 8:42:57 AM11/11/11
to pyins...@googlegroups.com
I am travelling next 48 hours, will try to sort on the weekend.
thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.

Martin Zibricky

unread,
Nov 11, 2011, 10:11:38 AM11/11/11
to pyins...@googlegroups.com
David Cortesi píše v Pá 11. 11. 2011 v 05:42 -0800:

> I am travelling next 48 hours, will try to sort on the weekend.
> thanks

To implement the hook you need to:

- find properly enchant plugins (e.g. libenchant_aspell.so,
libenchant_ispell.so, libenchant_myspell.so). On my system they are
located in /opt/local/lib/enchant (it's default location from macports).

- you should put these plugins in directory

YOUR_APP_DIST_DIR/lib/enchant

- then you need to force pyinstaller check to check these plugins for
dynamic depenencies on other .so or .dylib files. You could do this in a
similar way as it is done for qt_plugins. (e.g.
PYINSTALLER_TRUNK/PyInstaller/hooks/hook-PyQt4.QtGui.py)

- to test that it works there is a test case in pyinstaller:

PYINSTALLER_TRUNK/buildtests/libraries/test_enchant.py

- to run it use command

PYINSTALLER_TRUNK/buildtests/runtests.py libraries/test_enchant

- then you need some additional code co collect dictionaries

Hope this helps.


David Cortesi

unread,
Nov 14, 2011, 3:21:45 PM11/14/11
to pyins...@googlegroups.com
I'm sorry, I just find the pyinstaller "hooks" mechanism completely opaque. I can just about understand the TOC format and how it feeds  into the analyze and collect phases, but how and where the hooks fit in, and what their syntax is supposed to be -- I just don't get it.

I'm going to explore other ways of providing spellcheck to my app than enchant, which is clearly not a good way to go. Not only because pyinstaller can't handle it, but also because it is using myspell instead of hunspell, and other issues.

Thanks for your time.

Dave Cortesi

Martin Zibricky

unread,
Nov 14, 2011, 4:46:26 PM11/14/11
to pyins...@googlegroups.com
David Cortesi píše v Po 14. 11. 2011 v 12:21 -0800:

> I'm going to explore other ways of providing spellcheck to my app than
> enchant, which is clearly not a good way to go. Not only because
> pyinstaller can't handle it, but also because it is using myspell
> instead of hunspell, and other issues.

enchant can use both. It depends on backend plugins you have in your
enchant installation and on the format of dictionaries you have.

Hartmut Goebel

unread,
Nov 15, 2011, 3:16:11 AM11/15/11
to pyins...@googlegroups.com
Am 14.11.2011 21:21, schrieb David Cortesi:
> I'm sorry, I just find the pyinstaller "hooks" mechanism completely
> opaque. I can just about understand the TOC format and how it feeds
> into the analyze and collect phases, but how and where the hooks fit
> in, and what their syntax is supposed to be -- I just don't get it.

Have you read the section about Hooks
(http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html#hooks).

I must admit, that the Manual is not quite clear about this. I will try
to improve the text.

Hartmut Goebel

unread,
Nov 15, 2011, 7:00:47 AM11/15/11
to pyins...@googlegroups.com
Am 15.11.2011 09:16, schrieb Hartmut Goebel:
> Have you read the section about Hooks
> (http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html#hooks).
>
> I must admit, that the Manual is not quite clear about this. I will
> try to improve the text.
>
Done. Please give feedback if this help more.

David Cortesi

unread,
Nov 15, 2011, 11:22:44 AM11/15/11
to pyins...@googlegroups.com
On Tue, Nov 15, 2011 at 12:16 AM, Hartmut Goebel <h.go...@goebel-consult.de> wrote:

Have you read the section about Hooks (http://www.pyinstaller.org/export/latest/trunk/doc/Manual.html#hooks).

I must admit, that the Manual is not quite clear about this. I will try to improve the text.

That  would be good, but I think what is more important is that to me, it is not clear what pyinstaller is trying to do. It is trying to assemble a run-time environment that contains everything the app needs, yes, but what are all those pieces? And how are they arranged and connected to each other? You need to explain that first.

I am a programmer who just writes python code, grabs modules from pypi as needed, tries it out, great, it works! now let's magically make a package! -- it is not at all obvious where all the pieces live and what ties them together in the NORMAL situation, much less in a bundled app. You are immersed in it but you have left it all unstated and implied in the doc. (Which means I am sure, you are not getting enough credit for your cleverness!)

After you explain the structure of the end goal (the app bundle) you say, so here is how pyinstaller finds out all it needs to know to reach this situation in the normal case. But the big difficulty comes with apps that do such-and-so, and the way around this is...

Hartmut Goebel

unread,
Dec 9, 2011, 1:31:53 PM12/9/11
to pyins...@googlegroups.com
Am 15.11.2011 17:22, schrieb David Cortesi:


On Tue, Nov 15, 2011 at 12:16 AM, Hartmut Goebel <h.go...@goebel-consult.de> wrote:

I must admit, that the Manual is not quite clear about this. I will try to improve the text.

That  would be good, but I think what is more important is that to me, it is not clear what pyinstaller is trying to do. It is trying to assemble a run-time environment that contains everything the app needs, yes, but what are all those pieces? And how are they arranged and connected to each other? You need to explain that first.
I've made a ticket for this task.

Gabriel Reis

unread,
May 28, 2012, 11:17:51 AM5/28/12
to pyins...@googlegroups.com
Hi,

I was wondering if any progresses/improvements have been done regarding this matter with PyEnchant on Mac. I just gave a try here and couldn't make it work (using the version on trunk).

Many thanks,
Gabriel Reis


Reply all
Reply to author
Forward
0 new messages