aboSamoor / polyglot

Multilingual text (NLP) processing toolkit
http://polyglot-nlp.com
Other
2.32k stars 338 forks source link

No module named 'icu' #152

Open mihirpatel7 opened 6 years ago

mihirpatel7 commented 6 years ago

Traceback (most recent call last): File "D:/Sentiment/sentiment/SentimentDemo.py", line 2, in from polyglot.text import Text,Word File "C:\Python36\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\text.py", line 11, in from polyglot.detect import Detector, Language File "C:\Python36\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\detect__init__.py", line 1, in from .base import Detector, Language File "C:\Python36\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\detect\base.py", line 11, in from icu import Locale ModuleNotFoundError: No module named 'icu'

janissl commented 6 years ago

You may want to look here: https://github.com/aboSamoor/polyglot/issues/91#issuecomment-354667474

xiaodaoyoumin commented 5 years ago

@janissl I also met this problem , but my system is Ubuntu , what should I do ?

akornilo commented 5 years ago

I just figured out the Unix solution: Download this file https://pypi.org/project/PyICU/#files, untar, then run python setup.py install

MiguelNiblock commented 5 years ago

Im having the same issue, even after i installed ibicu-dev with sudo apt-get install libicu-dev

MiguelNiblock commented 5 years ago

I just figured out the Unix solution: Download this file https://pypi.org/project/PyICU/#files, untar, then run python setup.py install

I tried that on linux mint and I got this error:

x86_64-linux-gnu-gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
MiguelNiblock commented 5 years ago

Then when running pip install PyICU it also fails.

gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for PyICU
  Running setup.py clean for PyICU
Failed to build PyICU
Installing collected packages: PyICU
  Running setup.py install for PyICU ... error
    Complete output from command /home/user/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-tdpoh9i7/PyICU/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-record-88qnseku/install-record.txt --single-version-externally-managed --compile:
    (running 'icu-config --version')

    Building PyICU 2.3.1 for ICU 58.2

    (running 'icu-config --cxxflags --cppflags')
    Adding CFLAGS="-I/home/user/anaconda3/include" from /home/user/anaconda3/bin/icu-config
    (running 'icu-config --ldflags')
    Adding LFLAGS="-L/home/user/anaconda3/lib -licui18n -licuuc -licudata" from /home/user/anaconda3/bin/icu-config
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    copying PyICU.py -> build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/icu
    copying icu/__init__.py -> build/lib.linux-x86_64-3.7/icu
    running build_ext
    building '_icu' extension
    creating build/temp.linux-x86_64-3.7
    gcc -pthread -B /home/user/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/user/anaconda3/include/python3.7m -c _icu.cpp -o build/temp.linux-x86_64-3.7/_icu.o -I/home/user/anaconda3/include -DPYICU_VER="2.3.1"
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/user/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-tdpoh9i7/PyICU/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-record-88qnseku/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-tdpoh9i7/PyICU/
MiguelNiblock commented 5 years ago

It was all solved after I did the following:

sudo apt-get install build-essential

Then the following two could be installed successfully:

pip install PyICU and pip install pycld2

Then I could finally run polyglot.

grofte commented 5 years ago

Ubuntu

pip install polyglot
pip install pyicu
pip install pycld2
pip install morfessor

Is there any reason you can't set up the PyPI repository so that those are dependencies? Or at the very least write it in the installation section of your manual?

mdjadu commented 4 years ago

polyglot for windows 10 How to install it using python3.8 or using conda environment