aboSamoor / polyglot

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

Not able to install polyglot for Windows 10, Python version 3.6.5 #143

Closed danyal-s closed 6 years ago

danyal-s commented 6 years ago

Hello. I have been trying to install Polyglot on my Windows 10 machine but to no avail. I tried to solve this error through the various issues posted here, but none of them work for me.

It seems the issue arises when trying to install PyICU which is part of Polyglot's installation. I git cloned the repo and used python setup.py install to do so (since pip install polyglot gives an encoding error from cp1252 even though my Python's default encoding is UTF-8).

Searching for PyICU>=1.8
Reading https://pypi.python.org/simple/PyICU/
Downloading https://pypi.python.org/packages/bb/ef/3a7fcbba81bfd213e479131ae21445a2ddd14b46d70ef0109640b580bc5d/PyICU-2.0.3.tar.gz#md5=f2e696a3680be895170282297e036f40
Best match: PyICU 2.0.3
Processing PyICU-2.0.3.tar.gz
Writing C:\Users\me\AppData\Local\Temp\easy_install-188nt5fk\PyICU-2.0.3\setup.cfg
Running PyICU-2.0.3\setup.py -q bdist_egg --dist-dir C:\Users\me\AppData\Local\Temp\easy_install-188nt5fk\PyICU-2.0.3\egg-dist-tmp-d_y2eb25

Building PyICU 2.0.3 for ICU 2.0.3

_icu.cpp
c:\users\me\appdata\local\temp\easy_install-188nt5fk\pyicu-2.0.3\common.h(105): fatal error C1083: Cannot open include file: 'unicode/utypes.h': No such file or directory
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

Please help me out; I am totally stumped and have been trying for too long to fix this!

P.S: This is my first ever proper issue posted, so please go easy on me and let me know what else is considered helpful in such a forum.

janissl commented 6 years ago

Hi, PyICU must be installed using a .whl file on Windows. You may download it from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu

danyal-s commented 6 years ago

Hey, sorry if this is a silly question, but how do I find out which version is the right one for my machine? Through the link you provided me, these seem like the relevant ones:

PyICU‑2.0.3‑cp27‑cp27m‑win32.whl PyICU‑2.0.3‑cp27‑cp27m‑win_amd64.whl PyICU‑2.0.3‑cp34‑cp34m‑win32.whl PyICU‑2.0.3‑cp34‑cp34m‑win_amd64.whl PyICU‑2.0.3‑cp35‑cp35m‑win32.whl PyICU‑2.0.3‑cp35‑cp35m‑win_amd64.whl PyICU‑2.0.3‑cp36‑cp36m‑win32.whl PyICU‑2.0.3‑cp36‑cp36m‑win_amd64.whl PyICU‑2.0.3‑cp37‑cp37m‑win32.whl PyICU‑2.0.3‑cp37‑cp37m‑win_amd64.whl

I tried installing the last two but got an error: PS D:\Downloads> pip install .\PyICU-2.0.3-cp37-cp37m-win_amd64.whl PyICU-2.0.3-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform. PS D:\Downloads> pip install .\PyICU-2.0.3-cp37-cp37m-win32.whl PyICU-2.0.3-cp37-cp37m-win32.whl is not a supported wheel on this platform.

janissl commented 6 years ago

The correct version of the WHL file depends on your Python installation. The cp-part denotates your Python version (e.g. Python 3.6 -> cp36), the last part - the bitness of your Python installation, i.e. win32 -> 32-bit Python, win_amd64 -> 64-bit Python.

danyal-s commented 6 years ago

That helped; the setup went a stage forward (thanks for helping btw!), but now I am encountering this issue:

cl : Command line warning D9025 : overriding '/W3' with '/w' cl : Command line warning D9002 : ignoring unknown option '-m64' cl : Command line warning D9002 : ignoring unknown option '-fPIC' pycldmodule.cc bindings\pycldmodule.cc(16): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.13.26128\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

janissl commented 6 years ago

Also install the pycld2 package using a .whl file from here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycld2

Refer to polyglot/requirements.txt for all necessary packages.

danyal-s commented 6 years ago

Thank you so much! Finally got it to work. :) I really appreciate you helping me out with this. 😄

Hsgngr commented 3 years ago

@janissl method is 100% solved the problem. Thank you