简体   繁体   中英

Anaconda cannot install PyICU

My system is Windows 10 x86_64, anaconda 3.

My initial goal was to install polyglot for native language processing. Polyglot needs PyICU to work properly.

However, the default way to install PyICU doesn't work:

(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>pip install pyicu
Collecting pyicu
  Using cached PyICU-1.9.7.tar.gz
Exception:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
    return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 32: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
    wb.build(autobuilding=True)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
    line = console_to_str(proc.stdout.readline())
  File "C:\ProgramData\Anaconda3\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
    return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 32: invalid continuation byte

(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>

So, basically, neither console encoding nor utf-8 work.

How come? My Windows' locale is ru_RU, but the string doesn't seem to be in Russian. (Although it is possible that I just didn't manage to decode it.)

What to do?

(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>conda install icu="57.1"
Fetching package metadata ...........
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\ProgramData\Anaconda3:
#
icu                       57.1                     vc14_0  [vc14]

(C:\ProgramData\Anaconda3) C:\WINDOWS\system32>

I am not exactly sure what could be the problem with your setup (could not reproduce it), but it seems that installing PyICU on Windows is a rather inconvenient affair in general, as it requires you to build the package from source, which, in turn, requires to have all the necessary build tools, libraries and includes, all in proper places and matching versions.

Why don't you consider installing a pre-built package from here ?

> pip install PyICU-1.9.7-xx-xx-win_amd64.whl

You should try to download a corresponding whl file from here

Then open Anaconda Prompt as Administrator and execute the following:

python -m pip install <Path to whl here>\PyICU‑2.3.1‑cp37‑cp37m‑win_amd64.whl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM