polyglot icon indicating copy to clipboard operation
polyglot copied to clipboard

No module named 'icu'

Open mihirpatel7 opened this issue 6 years ago • 9 comments

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'

mihirpatel7 avatar Jun 19 '18 09:06 mihirpatel7

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

janissl avatar Jun 19 '18 11:06 janissl

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

Huijun-Cui avatar Feb 20 '19 03:02 Huijun-Cui

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

akornilo avatar Apr 18 '19 14:04 akornilo

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

MiguelNiblock avatar May 03 '19 20:05 MiguelNiblock

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 avatar May 03 '19 20:05 MiguelNiblock

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 avatar May 03 '19 22:05 MiguelNiblock

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.

MiguelNiblock avatar May 03 '19 23:05 MiguelNiblock

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?

grofte avatar Oct 14 '19 11:10 grofte

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

mdjadu avatar Oct 25 '20 13:10 mdjadu