Atefe Rj
Atefe Rj

Reputation: 1

installing polyglot in windows

I want to install polyglot but during installation requirement like pyIcu or pycld2 returns errors as They're clear in the code I have inserted below. I have tried to install pkg-config but my problem didnt solve.

I dont know how to set the ICU_VERSION environment variable to the version of ICU I have installed.

pip install polyglot
Requirement already satisfied: polyglot in c:\users\parsiran\anaconda3\lib\site-packages\polyglot-16.7.4-py3.7.egg (16.7.4)
Requirement already satisfied: numpy>=1.6.1 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (1.18.1)
Requirement already satisfied: wheel>=0.23.0 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (0.34.2)
Requirement already satisfied: six>=1.7.3 in c:\users\parsiran\anaconda3\lib\site-packages (from polyglot) (1.14.0)
Requirement already satisfied: morfessor>=2.0.2a1 in c:\users\parsiran\anaconda3\lib\site-packages\morfessor-2.0.6-py3.7.egg (from polyglot) (2.0.6)
Collecting pycld2>=0.3
  Using cached pycld2-0.41.tar.gz (41.4 MB)
Collecting PyICU>=1.8
  Using cached PyICU-2.4.3.tar.gz (219 kB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ParsIran\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ParsIran\\AppData\\Local\\Temp\\pip-install-wp28hyt4\\PyICU\\setup.py'"'"'; __file__='"'"'C:\\Users\\ParsIran\\AppData\\Local\\Temp\\pip-install-wp28hyt4\\PyICU\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\pip-egg-info'
         cwd: C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\
    Complete output (53 lines):
    (running 'icu-config --version')
    (running 'pkg-config --modversion icu-i18n')
    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 62, in <module>
        ICU_VERSION = os.environ['ICU_VERSION']
      File "C:\Users\ParsIran\anaconda3\lib\os.py", line 679, in __getitem__
        raise KeyError(key) from None
    KeyError: 'ICU_VERSION'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 65, in <module>
        ICU_VERSION = check_output(('icu-config', '--version')).strip()
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 18, in check_output
        return subprocess_check_output(popenargs)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 68, in <module>
        ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 18, in check_output
        return subprocess_check_output(popenargs)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\Users\ParsIran\anaconda3\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\ParsIran\AppData\Local\Temp\pip-install-wp28hyt4\PyICU\setup.py", line 73, in <module>
        ''')
    RuntimeError:
    Please install pkg-config on your system or set the ICU_VERSION environment
    variable to the version of ICU you have installed.

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Upvotes: 0

Views: 1805

Answers (1)

Guillaume Jacquenot
Guillaume Jacquenot

Reputation: 11717

PyICU is a Python package that uses binaries. When trying to install it, python downloads the source and tries to compile it: that's why need pkg-config and other tools.

Another solution is to install a version with binaries included. In this case, you do not need compiling tools to have it working.

You can download here a compiled version of PyICU suited to your Python installation.

I would recommend you to read these posts A and B to have detailed instructions.

Use these commands to identify your versions the following commands (Python version and 32/64 bit platform)

python --version
python.exe -c "import struct;print(struct.calcsize('P') * 8)"

Upvotes: 1

Related Questions