Mark B Mark B - 6 months ago 22
Python Question

Installing aspell for python 3 on MacOS X

I am trying to install aspell for Python 3 (on MacOS X 10.11), and have encountered an issue (the same one) using both pip and the manual installer (by cloning the git repo). I have already installed aspell using MacPorts (sudo port install aspell) as well as the english dictionary (sudo port install aspell-dict-en).

The error is obvious (aspell.h cannot be found), however I have no idea how to fix it.

Any help would be greatly appreciated.

$ sudo python3 build
running build
running build_ext
building 'aspell' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -I/opt/local/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c aspell.c -o build/temp.macosx-10.11-x86_64-3.5/aspell.o
aspell.c:53:10: fatal error: 'aspell.h' file not found
#include <aspell.h>
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1


Asked the same question on the project's GitHub page. Original can be found here. Copied here for convenience.

In case anybody encounters the same issue, I had installed aspell using MacPorts (sudo port install aspell) and had to include the dir '/opt/local/include', which is where the header file for aspell (aspell.h) was located. Hence, my looks like this:

module = Extension('aspell',
    libraries = ['aspell'],
    library_dirs = ['/usr/local/lib/'],
    include_dirs = ['/opt/local/include'],
    sources = ['aspell.c']