tastyminerals / nn_search2

Text analysis and part-of-speech searching utility
4 stars 2 forks source link

hunspell not installing OSX #16

Closed muranava closed 8 years ago

muranava commented 8 years ago

hi don't know if you can help but can't seem to install hunspell on OSX 10.11.4

Running setup.py install for hunspell ... error
    Complete output from command /Users/mura/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-9JiE5W/hunspell/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Bejal3-record/install-record.txt --single-version-externally-managed --compile:
    /Users/mura/anaconda/lib/python2.7/distutils/extension.py:133: 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.macosx-10.5-x86_64-2.7
    gcc -fno-strict-aliasing -I/Users/mura/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/hunspell -I/Users/mura/anaconda/include/python2.7 -c hunspell.c -o build/temp.macosx-10.5-x86_64-2.7/hunspell.o
    hunspell.c:21:10: fatal error: 'hunspell.h' file not found
    #include <hunspell.h>
             ^
    1 error generated.
    error: command 'gcc' failed with exit status 1
tastyminerals commented 8 years ago

Unfortunately I don't have MacOS to test, but here is what I found:

$ brew install hunspell
$ export C_INCLUDE_PATH=/usr/local/include/hunspell
$ sudo ln -sf /usr/local/lib/libhunspell-1.3.a /usr/local/lib/libhunspell.a
$ pip install hunspell

Source here.

tastyminerals commented 8 years ago

Also, today I replaced setup.py with linux_install.sh script which will install nn_search2 into ~/.nn_search directory.

muranava commented 8 years ago

hi thanks that worked but now getting no module error for perceptron but i have installed averaged_perceptron_tagger?:


Traceback (most recent call last): File "nn_search2.py", line 23, in import model File "/Users/mura/Downloads/nn_search2-master/nn_search2/model.py", line 28, in from nltk.tag.perceptron import PerceptronTagger ImportError: No module named perceptron 00000

tastyminerals commented 8 years ago

This means that you didn't install nltk.tag.perceptron package. Install all the dependencies first using the following command: python2 -m nltk.downloader punkt stopwords averaged_perceptron_tagger

Also, you can also try and use the following installation script: https://raw.githubusercontent.com/tastyminerals/nn_search2/master/linux_install.sh

This script will copy sources into ~/.nn_search2 and create a symlink /usr/local/bin/nn_search2 which you can call from command line to start the application from anywhere.

muranava commented 8 years ago

hi i did install all dependencies: /// [nltk_data] Downloading package punkt to /Users/mura/nltk_data... [nltk_data] Package punkt is already up-to-date! [nltk_data] Downloading package stopwords to /Users/mura/nltk_data... [nltk_data] Package stopwords is already up-to-date! [nltk_data] Downloading package averaged_perceptron_tagger to [nltk_data] /Users/mura/nltk_data... [nltk_data] Package averaged_perceptron_tagger is already up-to- [nltk_data] date! /// thx

tastyminerals commented 8 years ago

Also, it would be nice if you report any bugs you can find. Cheers!

muranava commented 8 years ago

hi sorry still getting perceptron not installed message even with linux_install.sh ( btw on my osx had to remove first line - #!/usr/bin/bash to get script to run) thx

tastyminerals commented 8 years ago

ok, are you sure you are installing dependencies for python2 and not for python3? What is your default python interpreter? You should run pip2 as: sudo pip2 install nltk not sudo pip install nltk which might be set for python3. Best way to check, run python2 interpreter and try from nltk.tag.perceptron import PerceptronTagger. If it get imported without error perceptron is installed.

muranava commented 8 years ago

hi yes did install for python2; maybe problem with anaconda python that i am using? tried in interpreter no dice, perceptron not installed

tastyminerals commented 8 years ago

Find out which python2 interpreter is you system using. Maybe Anaconda has a package manager that you can use and install the deps with it. I don't have Mac (never had) so I am of little help here.