aboSamoor / polyglot

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

polyglot windows installation #91

Closed netgateseznamcz closed 7 years ago

netgateseznamcz commented 7 years ago

I can't install polyglot on Windows 7 64 bit. I have tried python 3.4, 3.5, 3.6, various versions of PyICU, numpy, PyCld2 modules from http://www.lfd.uci.edu/~gohlke/pythonlibs/ but still without success. If somebody was successful with polyglot installation on Windows - could you please publish the successful combination of versions for: Python, PyICU, numpy and PyCld2 modules and type of their installations - wheel, github, pip etc..? Maybe some other tips?

I will really appreciate your help. Thank you.

Paul

sabriwi commented 7 years ago

Hi, what error are you getting?

I managed to install it on Windows 7 64 bit with Python 3.5 (anaconda installation). i had numpy installed anyway and installed PyICU and PyCld2 wheels from the website you mentioned (for Python 3.5) with pip install xxx.whl

(I had first tried to install polyglot without knowing that I needed PyICU and PyCld2 and I ran into a problem:

   File "c:\program files\anaconda3\lib\encodings\cp1252.py", line 23, in decode
   return codecs.charmap_decode(input,self.errors,decoding_table)[0]
   UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4941:
   character maps to <undefined>

which I solved by just deleting everything in the Readme file, however, I think I might not have got this error if I had installed the other two packages before. )

sabriwi commented 7 years ago

Just one further comment regarding the UnicodeDecodeError: my colleague still got this error when he tried to install polyglot with "pip install polyglot" (even when he had installed PyICU and PyCld2 before). The way to work around this was to download the sources and run "python setup.py install" (instead of using pip).

netgateseznamcz commented 7 years ago

thank you all for help and information. I have finally installed polyglot on windows pc!!! :-) configuration and steps:

Windows 7 Enterprise 64bit python-3.5.3-amd64.exe unzip https://github.com/aboSamoor/polyglot/archive/master.zip python setup.py install - in unzipped polyglot-master folder not pip install..... and it seems, that all required dependencies were installed also. that's all!

thank you also author for this amazing package

Proteusiq commented 6 years ago

I have finally installed it on Windows 10 64bit, Python 3.6(Conda with anaconda packages i.e. numpy): Thank you netgateseznamcz for your comments

Steps:

git clone https://github.com/aboSamoor/polyglot.git
python setup.py install

Downloaded and pip install

pip install pycld2-0.31-cp36-cp36m-win_amd64.whl
pip install PyICU-1.9.8-cp36-cp36m-win_amd64.whl
exbald commented 6 years ago

Win 10 64bit, Anaconda Python 3.6

I can confirm that above-mentioned steps worked:

git clone https://github.com/aboSamoor/polyglot.git
python setup.py install

Downloaded in installed:

pip install pycld2-0.31-cp36-cp36m-win_amd64.whl
pip install PyICU-1.9.8-cp36-cp36m-win_amd64.whl
pip install Morfessor-2.0.4-py2.py3-none-any.whl
polyglot download embeddings2.en
polyglot download ner2.en
pro100olga commented 5 years ago

I have installed polyglot using hints above (installed pyicu and pycld2 from .whl files and install polyglot from downloaded polyglot-master folder). Win10, Python 3.6

However, when I try to import something in IDE, I get error No module named 'icu._icu', for example:

import polyglot

from polyglot.text import Text
Traceback (most recent call last):

  File "<ipython-input-18-365fdab6978f>", line 1, in <module>
    from polyglot.text import Text

  File "C:\Users\olga.makarova\AppData\Local\Continuum\anaconda3\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\text.py", line 11, in <module>
    from polyglot.detect import Detector, Language

  File "C:\Users\olga.makarova\AppData\Local\Continuum\anaconda3\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\detect\__init__.py", line 1, in <module>
    from .base import Detector, Language

  File "C:\Users\olga.makarova\AppData\Local\Continuum\anaconda3\lib\site-packages\polyglot-16.7.4-py3.6.egg\polyglot\detect\base.py", line 11, in <module>
    from icu import Locale

  File "C:\Users\olga.makarova\AppData\Local\Continuum\anaconda3\lib\site-packages\icu\__init__.py", line 37, in <module>
    from ._icu import *

ModuleNotFoundError: No module named 'icu._icu'

but I have it installed:

(base) C:\Users\olga.makarova\Downloads>pip install pyicu
Requirement already satisfied: pyicu in c:\users\olga.makarova\appdata\local\continuum\anaconda3\lib\site-packages (2.2)

(base) C:\Users\olga.makarova\Downloads>pip install pycld2
Requirement already satisfied: pycld2 in c:\users\olga.makarova\appdata\local\continuum\anaconda3\lib\site-packages (0.31)

Can someone advise what to do?

MiguelNiblock commented 5 years ago

thank you all for help and information. I have finally installed polyglot on windows pc!!! :-) configuration and steps:

Windows 7 Enterprise 64bit python-3.5.3-amd64.exe unzip https://github.com/aboSamoor/polyglot/archive/master.zip python setup.py install - in unzipped polyglot-master folder not pip install..... and it seems, that all required dependencies were installed also. that's all!

thank you also author for this amazing package

I did that and installation was running fine until this part gave an error.

Processing dependencies for polyglot==16.7.4
Searching for PyICU>=1.8
Reading https://pypi.org/simple/PyICU/
Downloading https://files.pythonhosted.org/packages/e9/35/211ffb949c68e688ade7d40426de030a24eaec4b6c45330eeb9c0285f43a/PyICU-2.3.1.tar.gz#sha256=ddb2b453853b4c25db382bc5e8c4cde09b3f4696ef1e1494f8294e174f459cf4
Best match: PyICU 2.3.1
Processing PyICU-2.3.1.tar.gz
Writing /tmp/easy_install-ys2a_0jk/PyICU-2.3.1/setup.cfg
Running PyICU-2.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ys2a_0jk/PyICU-2.3.1/egg-dist-tmp-9rsuurdz
(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
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1
creaturedee commented 5 years ago

I installed polyglot using the above mentioned instructions but it is still giving an error. While using the function polyglot in Jupyter using 'import polyglot', ModuleNotFoundError: No module named 'polyglot'

Please advise.

orientune commented 4 years ago

Me too :( I installed polyglot using the above mentioned instructions but it is still giving an error. ModuleNotFoundError Traceback (most recent call last)

in ----> 1 import polyglot ModuleNotFoundError: No module named 'polyglot'
ProfessorAlexandreSarquis commented 4 years ago

I'm a Windows 10 64bits Python 3.7 Anaconda user. Sorry for the lousy english: not my first language. This is what I've got so far

1 - Downloaded the files pycld2-0.41-cp37-cp37m-win_amd64.whl from here https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu

2 - Ran "pip install pycld2-0.41-cp37-cp37m-win_amd64.whl"

** note "cp3X" means cpython 3.x. You need to get your own version.

3 - Downloaded the files PyICU-2.4.3-cp37-cp37m-win_amd64.whl from here https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu

4 - Ran "pip install PyICU-2.4.3-cp37-cp37m-win_amd64.whl"

** the same as before, "cp3X" means cpython 3.x. You need to get your own version.

5 - Got the .tar.gz from https://pypi.org/project/polyglot/#files

6 - Unzipped it till I got to the setup.py

7 - Erased everything from the "readme.rst" file

8 - Ran "python setup.py install"

9 - Ran "conda install -c conda-forge morfessor" (i always try conda-forge first)

10 - Altered file "downloader.py" located at "C:\ProgramData\Anaconda3\envs\untitled\Lib\site-packages\polyglot-16.7.4-py3.7.egg\polyglot", altering "path.sep" for "/"

id_ = id_.split("/") ### id_ = id_.split(path.sep)
id = ".".join(id_[1:3])
name = attrs["name"].replace("/", '.') ## name = attrs["name"].replace(path.sep, '.')
subdir = path.dirname(attrs["name"])
url = attrs["mediaLink"]
size = attrs["size"]
filename = attrs["name"]
task = subdir.split("/")[0] ## task = subdir.split(path.sep)[0]
language = subdir.split("/")[1] ## language = subdir.split(path.sep)[1]

11 - Tried to download embeddings2.pt.

12 - Couldn't.

13 - Tiped this instead.

14 - Posted.