1

I would like to use the python polyglot library but I couldn't manage to use it I installed it using the command

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

when I want to try the code proposed on their documentation I have the following error:

Traceback (most recent call last):
  File "C:/Users/≈/PycharmProjects/s+7/main.py", line 1, in <module>
    import polyglot.text
  File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.7.egg\polyglot\text.py", line 11, in <module>
    from polyglot.detect import Detector, Language
  File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.7.egg\polyglot\detect\__init__.py", line 1, in <module >
    from .base import Detector, Language
  File "C:\Users\=\PycharmProjects\s+7\venv\lib\site-packages\polyglot-16.7.4-py3.

7.egg\polyglot\detect\base.py", line 11, in <module >
        from icu import Locale

ModuleNotFoundError: No module named 'icu'

and I failed to install pyicu. So if someone has a solution to offer me, I'm a taker. I already try solution that on stackooverflow but it did not work.

edit: i try to install pyicu

PS C:\Users\=\PycharmProjects\s+7> python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\=\pycharmprojects\s+7\venv\lib\site-packages (21.1.2)
Collecting pip
  Using cached pip-22.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.1.2
    Uninstalling pip-21.1.2:
      Successfully uninstalled pip-21.1.2
Successfully installed pip-22.1
PS C:\Users\=\PycharmProjects\s+7> pip install pyicu                  
Collecting pyicu
  Using cached PyICU-2.9.tar.gz (305 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [64 lines of output]
      (running 'icu-config --version')
      (running 'pkg-config --modversion icu-i18n')
      Traceback (most recent call last):
        File "setup.py", line 63, in <module>
          ICU_VERSION = os.environ['ICU_VERSION']
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\os.py", line 681, 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 "setup.py", line 66, in <module>
          ICU_VERSION = check_output(('icu-config', '--version')).strip()
        File "setup.py", line 19, in check_output
          return subprocess_check_output(popenargs)
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 411, in check_output
          **kwargs).stdout
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 488, in run
          with Popen(*popenargs, **kwargs) as process:
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
          restore_signals, start_new_session)
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
          startupinfo)
      FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "setup.py", line 69, in <module>
          ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
        File "setup.py", line 19, in check_output
          return subprocess_check_output(popenargs)
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 411, in check_output
          **kwargs).stdout
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 488, in run
          with Popen(*popenargs, **kwargs) as process:
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
          restore_signals, start_new_session)
        File "C:\Users\=\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
          startupinfo)
      FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "c:\users\=\pycharmprojects\s+7\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
          main()
        File "c:\users\=\pycharmprojects\s+7\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "c:\users\=\pycharmprojects\s+7\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 178, in get_requires_for_build_wheel
          config_settings, requirements=['wheel'])
        File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "C:\Users\=\AppData\Local\Temp\pip-build-env-sce37r8e\overlay\Lib\site-packages\setuptools\build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 74, 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.
      
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

and i try that : installing polyglot in windows

thanks for reading

An0n7me
  • 11
  • 3
  • Could you link to the solution you tried, but that didn't work? It would help others understand your problem (and know what not to suggest). Also, what does "failed to install pyicu" mean? What happened? What error(s) did you get? – CrazyChucky May 20 '22 at 20:54
  • Did you follow the [directions for installing PyICU](https://pypi.org/project/PyICU/)? – CrazyChucky May 21 '22 at 17:26
  • Finally i use this post to solve my problem : [here](https://stackoverflow.com/questions/56966629/i-had-issue-with-installing-icu-in-python-3-5-windows-10) – An0n7me May 24 '22 at 15:53

0 Answers0