Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing hunspell package

I'm looking forward to install the hunspell package using pip, but it throws the following error:

Collecting hunspell
  Using cached hunspell-0.4.1.tar.gz
Building wheels for collected packages: hunspell
  Running setup.py bdist_wheel for hunspell ... error
  Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/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 /tmp/tmphqvqt4lxpip-wheel- --python-tag cp34:
  /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'hunspell' extension
  creating build
  creating build/temp.linux-x86_64-3.4
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
  hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
   #include <hunspell.h>
                        ^
  compilation terminée.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
    Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-euhsmasb-record/install-record.txt --single-version-externally-managed --compile:
    /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'hunspell' extension
    creating build
    creating build/temp.linux-x86_64-3.4
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
    hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
     #include <hunspell.h>
                          ^
    compilation terminée.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-oyfpp3iy/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-euhsmasb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-oyfpp3iy/hunspell/
[root@localhost Bureau]# alias python-devel=python34-devel
[root@localhost Bureau]# pip install hunspell
Collecting hunspell
  Using cached hunspell-0.4.1.tar.gz
Building wheels for collected packages: hunspell
  Running setup.py bdist_wheel for hunspell ... error
  Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/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 /tmp/tmptwg_9c8vpip-wheel- --python-tag cp34:
  /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'hunspell' extension
  creating build
  creating build/temp.linux-x86_64-3.4
  gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
  hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
   #include <hunspell.h>
                        ^
  compilation terminée.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
    Complete output from command /root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zrlp2go9-record/install-record.txt --single-version-externally-managed --compile:
    /root/anaconda3/lib/python3.4/distutils/extension.py:132: UserWarning: Unknown Extension options: 'compile_args', 'macros'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'hunspell' extension
    creating build
    creating build/temp.linux-x86_64-3.4
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/include/hunspell -I/root/anaconda3/include/python3.4m -c hunspell.c -o build/temp.linux-x86_64-3.4/hunspell.o
    hunspell.c:21:22: erreur fatale: hunspell.h : Aucun fichier ou dossier de ce type
     #include <hunspell.h>
                          ^
    compilation terminée.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/root/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xpljhkom/hunspell/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-zrlp2go9-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-xpljhkom/hunspell/

And I've heard that installing python3-dev would resolve the problem. I tried with no succes. I'm using python 3.4 under CentOS 7. Can I get some help please ? Thanks in advance.

like image 410
ABK Avatar asked May 03 '17 09:05

ABK


People also ask

What is Hunspell package?

Hunspell is the spell checker library used by LibreOffice, OpenOffice, Mozilla Firefox, Google Chrome, Mac OS-X, InDesign, Opera, RStudio and many others. It provides a system for tokenizing, stemming and spelling in almost any language or alphabet.

What is hunspell in Python?

pyhunspell is a set of Python bindings for the Hunspell spellchecker engine. It lets developers load Hunspell dictionaries, check words, get suggestions, add new words, etc. It also provides some basic morphological analysis related methods.


3 Answers

I just went through this using python3.4 and pip3.4 on Centos7 64-bit. (NB you need both python3.4 and pip3.4)

I eventually got it working via pip3.4, but before this would work, I had to take a few extra steps. The steps I took were:

Install the python3.4 development headers:

sudo yum install python34u-devel.x86_64

Install hunspell and hunspell-devel (needed for hunspell.h and hunspell lib):

sudo yum install hunspell hunspell-devel

In /usr/lib64/, add an extra symlink for the hunspell library:

sudo ln -s libhunspell-1.3.so libhunspell.so

Finally, run the command:

sudo pip3.4 install hunspell

... and this gave me the following output:

... (compiler output deleted) ...
Successfully built hunspell
Installing collected packages: hunspell
Successfully installed hunspell-0.4.1
like image 94
AS Mackay Avatar answered Sep 30 '22 09:09

AS Mackay


Try This:

sudo apt install python-dev libhunspell-dev
pip install hunspell
like image 28
SAIF AHMAD KHAN Avatar answered Sep 30 '22 07:09

SAIF AHMAD KHAN


Solution by OP.

I figured it out, I'll share this method here, it may help :) first you need to install python-devel and

yum install python-devel  
yum install hunspell-devel  

then corrected your symlink

cd /usr/lib64
sudo ln -s libhunspell-1.3.so.0.0.0 libhunspell.so
ls -l | grep hunspell

Good Luck :)

like image 23
Cœur Avatar answered Sep 30 '22 07:09

Cœur