WojciechMula/aspell-python

pip3 install fails: aspell.h not found

itsayellow opened this issue · 16 comments

I tried to install using pip3 on MacOS Sierra, using homebrew and python 3.6.2, and I get the following error (aspell.h not found):

>$ pip3 install aspell-python-py3
Collecting aspell-python-py3
  Downloading aspell-python-py3-1.15.tar.bz2
Building wheels for collected packages: aspell-python-py3
  Running setup.py bdist_wheel for aspell-python-py3 ... error
  Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-build-2b4ebsy7/aspell-python-py3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/tmp72mb0nhcpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_ext
  building 'aspell' extension
  creating build
  creating build/temp.macosx-10.12-x86_64-3.6
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c aspell.c -o build/temp.macosx-10.12-x86_64-3.6/aspell.o
  aspell.c:53:10: fatal error: 'aspell.h' file not found
  #include <aspell.h>
           ^
  1 error generated.
  error: command 'clang' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for aspell-python-py3
  Running setup.py clean for aspell-python-py3
Failed to build aspell-python-py3
Installing collected packages: aspell-python-py3
  Running setup.py install for aspell-python-py3 ... error
    Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-build-2b4ebsy7/aspell-python-py3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-0vdjc8ff-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'aspell' extension
    creating build
    creating build/temp.macosx-10.12-x86_64-3.6
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c aspell.c -o build/temp.macosx-10.12-x86_64-3.6/aspell.o
    aspell.c:53:10: fatal error: 'aspell.h' file not found
    #include <aspell.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-build-2b4ebsy7/aspell-python-py3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-0vdjc8ff-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/w_/8np4m5mj3x3d9kvd9zq2s2580000gn/T/pip-build-2b4ebsy7/aspell-python-py3/

Thank you for the report. Do you have aspell-dev installed? If you have, what's the full path to aspell.h?

No, I don't have aspell-dev installed. I'm sorry that I wasn't aware I needed it. Is this an external dependency?

Ah! I was confused which computer I was on. This computer had NO aspell installed.
So when I ran:
brew install aspell
then
pip3 install aspell-python-py3
worked fine.
So in the end I just needed to brew install aspell and it worked.

Good that you fixed the problem. However, it would be great if setup checked (somehow) for aspell.h presence.

Yes it would be nice. And thanks for your help and attention. :)

I have the same problem, but I did run brew install aspell and then tried pip3 install aspell-python-py3
I get the same error 'aspell.h' not found. Is there any other solution, using which I can solve this problem?

Found out the solution, I installed using setup.py

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

/usr/local/include is where my aspell.h was present, we need to find the location and add it to the setup.py to install.

@sjagadee It works, but you had to manually modify the file. I'm looking for a better solution. :)

Hi guys,
I am facing the same problem but while using Windows. Can someone please help?

Some binary wheels on pypi would be nice.

sudo apt-get install libaspell-dev

@mbarkhau that's a long-standing issue... any help to make it possible is warmly welcomed :)

@WojciechMula do you know if there are any licensing issues if compiled artifacts of GNU Aspell are included?

Did some research. I'm no expert, but I guess as long as there is a link to http://aspell.net/ there should not be a problem to distribute binaries that are based on the original unchanged source.

@mbarkhau Thanks for checking!

sudo apt-get install libaspell-dev

Thanks alot. This worked for me!