Installation on Mac Os Snow Leopard

468 views
Skip to first unread message

projetmbc

unread,
Jun 17, 2010, 10:19:21 AM6/17/10
to pyenchant users
Hello,
I've tried to build enchant on my Mac OS. I've downloaded
enchant-1.6.0. Then I go to this directory in a terminal, then I
type :

./configure

No success. I've the following error message :

----------------------------------------------------------------------------------------------------------------------------------
...
checking for pkg-config... no
checking pkg-config is at least version 0.9.0... ./configure: line
17118: no: command not found
no
checking for ENCHANT... configure: error: in `/Users/cbal/Downloads/
enchant-1.6.0':
configure: error: The pkg-config script could not be found or is too
old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables ENCHANT_CFLAGS
and ENCHANT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details.
----------------------------------------------------------------------------------------------------------------------------------

Someone can help me ? I don't know the language C.

PS : the use of easy_install fpor pyenchant on a Mac seems to work.
The only problem is the preceding one with the C library enchant.

Ryan Kelly

unread,
Jun 17, 2010, 8:13:08 PM6/17/10
to pyencha...@googlegroups.com, proj...@gmail.com
On Thu, 2010-06-17 at 07:19 -0700, projetmbc wrote:
> Hello,
> I've tried to build enchant on my Mac OS. I've downloaded
> enchant-1.6.0. Then I go to this directory in a terminal, then I
> type :
>
> ./configure
>
> ...snip...

>
> Someone can help me ? I don't know the language C.


The difficult is that enchant has a few dependencies that aren't
installed by default on the Mac. If requires an installation of glib:

http://ftp.gnome.org/pub/gnome/sources/glib/2.24/

As well as a spellchecking backend like aspell:

http://aspell.net/

Installing all of these from source is, frankly, not for the faint of
heart.


I *strongly* recommend using macports. This is an automated build
system that will download the necessary sources, configure and install
them for you with a single command:

http://www.macports.org/install.php


Once you have installed macports, this command should be all that's
required to get you up and running with PyEnchant:

> sudo port install enchant aspell-dict-en


> PS : the use of easy_install fpor pyenchant on a Mac seems to work.
> The only problem is the preceding one with the C library enchant.

Yes, eventually I will bundle a prebuilt enchant library into some eggs
for OSX, I just haven't got around to it yet...


Cheers,

Ryan

--
Ryan Kelly
http://www.rfk.id.au | This message is digitally signed. Please visit
ry...@rfk.id.au | http://www.rfk.id.au/ramblings/gpg/ for details


projetmbc

unread,
Jun 19, 2010, 5:03:33 AM6/19/10
to pyenchant users
Hello,
I've used macport to install enchant but when I've tried to import
enchant in a Python script, I've the following message :

====================================================================================
Traceback (most recent call last):
File "/Users......", line 21, in <module>
import enchant
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
__init__.py", line 91, in <module>
from enchant import _enchant as _e
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
_enchant.py", line 86, in <module>
raise ImportError("enchant C library not found")
ImportError: enchant C library not found
====================================================================================

I can launch enchant in a Terminal. What can I do ?

Note : pyenchant was first installed using easy_install, and then I've
installed enchant using macport.

Best regard.
C.

projetmbc

unread,
Jun 19, 2010, 2:48:47 PM6/19/10
to pyenchant users
Hello bis,
I've put the C compiled file enchant in the same folder of _enchant.py
Then I've the following error :

==========================================================================================
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
__init__.py", line 91, in <module>
from enchant import _enchant as _e
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
_enchant.py", line 86, in <module>
raise ImportError("enchant C library not found")
ImportError: enchant C library not found
>>> import enchant
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
__init__.py", line 91, in <module>
from enchant import _enchant as _e
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
_enchant.py", line 55, in <module>
from enchant import utils
ImportError: cannot import name utils
==========================================================================================

What's missing ?

Best regards.

projetmbc

unread,
Jun 18, 2010, 7:52:20 AM6/18/10
to pyenchant users
Hello.

>>> I *strongly* recommend using macports.

I do not really like to use it but the way to compile enchant seems to
difficult for me. So I will use macports.

>>> Yes, eventually I will bundle a prebuilt enchant library
>>> into some eggs for OSX, I just haven't got around to it yet...

That sounds great.

Thanks for all.

Ryan Kelly

unread,
Jun 19, 2010, 10:42:50 PM6/19/10
to pyencha...@googlegroups.com
On Sat, 2010-06-19 at 11:48 -0700, projetmbc wrote:
> Hello bis,
> I've put the C compiled file enchant in the same folder of _enchant.py

I won't be surprised if that breaks things, enchant tends to look for
its dictionaries etc relative to the location of the main enchant
library.

Where did the enchant library end up after installing by macports?
Enchant *should* be looking in /opt/local/lib/ by default.


> Then I've the following error :

> >>> import enchant


> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
> __init__.py", line 91, in <module>
> from enchant import _enchant as _e
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
> _enchant.py", line 55, in <module>
> from enchant import utils
> ImportError: cannot import name utils
> ==========================================================================================
>
> What's missing ?

OK, a couple of things to try:

* can you import "enchant.utils" directly from the python prompt? If
so, this suggests a relative-import problem, possibly because of
additional files in the enchant package directory. Please send a list
of all the files in your enchant package dir.

* remove the compiled enchant lib from the folder with _enchant.py,
and instead set the path to it in the environment variable
PYENCHANT_LIBRARY_PATH. Example:

#> PYENCHANT_LIBRARY_PATH=/opt/local/lib/libenchant.dylib python
>>> import enchant
>>>


As a last resort, you can edit the _enchant.py file directory to point
it at the correct location of the compiled enchant library.

projetmbc

unread,
Jun 20, 2010, 6:08:34 AM6/20/10
to pyenchant users
Hello,
I've decided to take a look in _enchant.py , and I've seen the path "/
opt/local/lib/libenchant.dylib"is found. Then I've tried the following
just after your imports :

---------------------------------------------------------------
cdll.LoadLibrary("/opt/local/lib/libenchant.dylib")
---------------------------------------------------------------

This sends me the following error message :

==============================================================================================================
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
_enchant.py", line 55, in <module>
from enchant import utils
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
__init__.py", line 91, in <module>
from enchant import _enchant as _e
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyenchant-1.6.2-py2.6.egg/enchant/
_enchant.py", line 81, in <module>
cdll.LoadLibrary("/opt/local/lib/libenchant.dylib")
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/local/lib/libenchant.dylib, 6): no suitable image
found. Did find:
/opt/local/lib/libenchant.dylib: mach-o, but wrong architecture
==============================================================================================================

I think I am in serious trouble... Isn't it ?

Ryan Kelly

unread,
Jun 20, 2010, 6:17:51 AM6/20/10
to pyencha...@googlegroups.com


Ah, now we see that your aversion to macports was a least partially
justified :-(

It looks like macports has built only the 32-bit version of enchant, but
python is looking for the 64-bit version.

Try taking a look in /opt/local/etc/macports.conf for the "os.arch"
setting. If it's set to "i386", change it to "x86_64" and rebuild
enchant.

(or if you're feeling adventurous, try to build it as a universal binary
- but you'll have to consult the macports guide for how to do that)

projetmbc

unread,
Jun 20, 2010, 12:55:04 PM6/20/10
to pyenchant users
> Try taking a look in /opt/local/etc/macports.conf for the "os.arch"
> setting.  If it's set to "i386", change it to "x86_64" and rebuild
> enchant.

I have the following :

============================================
# CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X
10.5
# and earlier, depending on the CPU type detected at runtime. On Mac
OS X 10.6
# the default is x86_64 if the CPU supports it, i386 otherwise.
#build_arch x86_64

# CPU architectures to use for Universal Binaries (+universal variant)
universal_archs x86_64 i386
============================================

Is there at least one way to test in the Terminalm that enchant
works ?

I will seek to another way to spell text on Windows, Linux and Mac at
the same time because it's too complicated for the moment to use yor
library which is very usefull. Why don't you build something that will
work on a Mac ?

projetmbc

unread,
Jun 20, 2010, 1:00:02 PM6/20/10
to pyenchant users
Indeed I will use pyenchnat for Windows and Linux, and I will see for
another solution on Mac. Do you know such a solution ?

Ryan Kelly

unread,
Jun 20, 2010, 7:10:18 PM6/20/10
to pyencha...@googlegroups.com
On Sun, 2010-06-20 at 10:00 -0700, projetmbc wrote:
> Indeed I will use pyenchnat for Windows and Linux, and I will see for
> another solution on Mac. Do you know such a solution ?

You might have some luck with the various python aspell wrappers - just
google "python aspell" and you should find one. But again, they depend
on compiling and installing an underlying spell-checking engine.

Ryan Kelly

unread,
Jun 20, 2010, 7:22:24 PM6/20/10
to pyencha...@googlegroups.com
On Sun, 2010-06-20 at 09:55 -0700, projetmbc wrote:
> > Try taking a look in /opt/local/etc/macports.conf for the "os.arch"
> > setting. If it's set to "i386", change it to "x86_64" and rebuild
> > enchant.
>
> I have the following :
>
> ============================================
> # CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X
> 10.5
> # and earlier, depending on the CPU type detected at runtime. On Mac
> OS X 10.6
> # the default is x86_64 if the CPU supports it, i386 otherwise.
> #build_arch x86_64
>
> # CPU architectures to use for Universal Binaries (+universal variant)
> universal_archs x86_64 i386
> ============================================

Hmmm. Are you using the python version that came installed with the
mac, or a different version? Perhaps python is expecting 32-bit
libraries and enchant is only built 64-bit.

> Is there at least one way to test in the Terminalm that enchant
> works ?

Sorry, I don't have access to my Mac at the moment to test it out, but
you should be able to run "enchant-lsmod" from the command line. This
lists the backends available to enchant, if you get at least one line of
output then enchant should be working on your system.

> I will seek to another way to spell text on Windows, Linux and Mac at
> the same time because it's too complicated for the moment to use yor
> library which is very usefull. Why don't you build something that will
> work on a Mac ?

I'm really not sure how to take that last comment. The answer, as
usual, is that I do this in my spare time and it hasn't been a priority
for me. I will *try* to include pre-built version in the next release.

Regardless, this usually does work on the mac. The procedure I
suggested using macports has worked for me and at least two other people
who have bothered to report their success to me.

It's possible this problem is unique to Snow Leopard and the particular
variant of python you have installed. When I get a chance I'll try it
again using both the default system python and the one from python.org.

If you find an alternate spell-checking library that works for you on
the mac, please report your success to the list so that anyone who finds
this thread in Google can have some resolution. It's always good to
have a record of what works and what doesn't.


Cheers,

signature.asc

projetmbc

unread,
Jun 26, 2010, 10:54:13 AM6/26/10
to pyenchant users
Hello,
can you give a command line to type in the Terminal so as to test if
enchant works ?

Ryan Kelly

unread,
Jun 26, 2010, 5:58:40 PM6/26/10
to pyencha...@googlegroups.com

Try "enchant-lsmod" for a start, this will list the installed enchant
spelling providers.

projetmbc

unread,
Jun 27, 2010, 10:30:05 AM6/27/10
to pyenchant users
> Try "enchant-lsmod" for a start, this will list the installed enchant
> spelling providers.
I've tried and I have the following :
aspell (Aspell Provider)
ispell (Ispell Provider)
myspell (Myspell Provider)

projetmbc

unread,
Jun 27, 2010, 8:24:58 AM6/27/10
to pyenchant users
> Hmmm.  Are you using the python version that came installed with the
> mac, or a different version?  Perhaps python is expecting 32-bit
> libraries and enchant is only built 64-bit.

So sorry to not have told you this before. The problem comes surely
from that. You're right.
I've used Mac Port so as to install enchant, and I use Python 2.6.
from the dmg installer.
I've asked the question in the mailing list of Mac Port.

> I'm really not sure how to take that last comment.  The answer, as
> usual, is that I do this in my spare time and it hasn't been a priority
> for me.  I will *try* to include  pre-built version in the next release.

That was just a remark and I do not ask you to do the job. Sorry if I
hurted you. Indeed I'm very disappointed to not use enchant on my Mac.


> It's possible this problem is unique to Snow Leopard and the particular
> variant of python you have installed.  When I get a chance I'll try it
> again using both the default system python and the one from python.org.

I can do test if you want. If I can help, I will be happy.

> If you find an alternate spell-checking library that works for you on
> the mac, please report your success to the list so that anyone who finds
> this thread in Google can have some resolution.  It's always good to
> have a record of what works and what doesn't.

That's the way I see things.

Best regards.

projetmbc

unread,
Jun 27, 2010, 8:05:21 AM6/27/10
to pyenchant users
> Hmmm.  Are you using the python version that came installed with the
> mac, or a different version?  Perhaps python is expecting 32-bit
> libraries and enchant is only built 64-bit.

So sorry to not have told you this before. The problem comes surely
from that. You're right, I've used Mac Port so as to install enchant,
and I use Python 2.6. from the dmg installer.


> I'm really not sure how to take that last comment.  The answer, as
> usual, is that I do this in my spare time and it hasn't been a priority
> for me.  I will *try* to include  pre-built version in the next release.

That was just a remark and I do not ask you to do the job. Sorry if I
hurted you. Indeed I'm very disappointed that I cannot use pyenchant
on my Mac because I really appreciate it.


> It's possible this problem is unique to Snow Leopard and the particular
> variant of python you have installed.  When I get a chance I'll try it
> again using both the default system python and the one from python.org.

I can do test if you want. If I can help, I will be happy.


> If you find an alternate spell-checking library that works for you on
> the mac, please report your success to the list so that anyone who finds
> this thread in Google can have some resolution.

Ryan Kelly

unread,
Jun 27, 2010, 7:11:59 PM6/27/10
to pyencha...@googlegroups.com

That looks about right, I'd say your enchant library is definitely
working.

Ryan Kelly

unread,
Jun 27, 2010, 7:11:33 PM6/27/10
to pyencha...@googlegroups.com
On Sun, 2010-06-27 at 05:05 -0700, projetmbc wrote:
> > Hmmm. Are you using the python version that came installed with the
> > mac, or a different version? Perhaps python is expecting 32-bit
> > libraries and enchant is only built 64-bit.
>
> So sorry to not have told you this before. The problem comes surely
> from that. You're right, I've used Mac Port so as to install enchant,
> and I use Python 2.6. from the dmg installer.

OK, I will try to test under that scenario and see what the solution is.

One option would be to built enchant as "universal". Try putting
"+universal" in the file /opt/local/etc/macports/variants.conf and
re-building enchant and its dependencies.

(I don't recall the exact syntax for the variants.conf file sorry, but I
think adding +universal should do it)

> > I'm really not sure how to take that last comment. The answer, as
> > usual, is that I do this in my spare time and it hasn't been a priority
> > for me. I will *try* to include pre-built version in the next release.
>
> That was just a remark and I do not ask you to do the job. Sorry if I
> hurted you.

No problem. I haven't been getting much sleep lately so I'm sorry if I
was snarky.

These are all bugs and corner-cases that I would have come across
eventually, so it's good that you're helping me ferret them out :-)

projetmbc

unread,
Jun 28, 2010, 6:16:27 AM6/28/10
to pyenchant users
> One option would be to built enchant as "universal".
> Try putting "+universal" in the file /opt/local/etc/macports/variants.conf
> and re-building enchant and its dependencies.

Thanks a lot ! That works.
Reply all
Reply to author
Forward
0 new messages