3

I am trying to install pyenchant on Mac OS X Yosemite. It works fine on linux machines but not in mac, I am having the following error:

ImportError: The 'enchant' C library was not found. Please install it via your OS package manager, or use a pre-built binary wheel from PyPI.

This is how I installed the package:

pip install pyenchant

and next, I import it in this way:

import enchant

I am using Python 3.4.

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
user2161903
  • 577
  • 1
  • 6
  • 22
  • And have you *"install[ed] it via your OS package manager, or use[d] a pre-built binary wheel from PyPI"*? – jonrsharpe Sep 28 '15 at 15:21
  • I installed the package using the pip command, that's all what I did. – user2161903 Sep 28 '15 at 15:33
  • If that's all you've done, **why?!** Have you read e.g. https://pythonhosted.org/pyenchant/download.html? – jonrsharpe Sep 28 '15 at 15:34
  • I have put the source distribution inside the enchant installation as well. Is there anything that I missed. I have read the manual multiple times. – user2161903 Sep 28 '15 at 15:41
  • What do you mean *"put the source distribution inside"*? That's not the same as installation. See e.g. http://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file – jonrsharpe Sep 28 '15 at 15:41
  • Here is what I did: `pip install pyenchant`. I downloaded pyenchant source distribution. I unzipped it. when I ran, `python setup.py install' I am having the error. Any suggestions? – user2161903 Sep 28 '15 at 15:50
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/90814/discussion-between-user2161903-and-jonrsharpe). – user2161903 Sep 28 '15 at 15:56
  • No, I'm good, thanks – jonrsharpe Sep 28 '15 at 16:06

2 Answers2

1

Enchant is a C library, and pyenchant provides Python bindings to that library. For your code to work, you need to install Enchant as well. If you're using homebrew, you can use:

>>brew install enchant

After installing Enchant, you can then install Pyenchant:

>>pip install pyenchant

I hope this helps.

rug3y
  • 104
  • 4
  • `brew install enchant` or `brew install pyenchant`? I installed it using `pip`, is `brew` going to make any difference? – user2161903 Sep 30 '15 at 17:44
  • Enchant and pyenchat are two different projects. Enchant is the generic interface into various existing spell checking libaries. (https://github.com/AbiWord/enchant) Pyenchant provides a set of Python language bindings for the Enchant spellchecking library. – gogasca May 24 '16 at 00:06
0

Also, make sure your Xcode is updated. If it is not updated, you will get an error when running the brew installer:
configure: error: cannot run C compiled programs.

Weezy.F
  • 454
  • 5
  • 10