Как установить pyicu на Ubuntu 21.04

#linux #docker #pip #python-3.6 #ubuntu-21.04

#linux #докер #пип #python-3.6 #ubuntu-21.04

Вопрос:

У меня есть образ docker, который я пытаюсь установить pyicu (версия 2.3, но другие версии также не устанавливаются). Там работает установка pyicu. Раньше я создавал FROM python:3.6 файл Dockerfile, но теперь обновляю его до use ubuntu:21.04 и получаю сообщение об ошибке, приведенное ниже. Используя Python 3.6 и работая apt-get -y update amp;amp; apt-get install -y --no-install-recommends libicu-dev в обоих.

Я вижу, что потенциальная проблема может заключаться в том, что pkg-config пакет был удален из Ubuntu 21 https://www.ubuntuupdates.org/package/core/impish/main/proposed/pkg-config . Является ли это корнем проблемы, и если да, то как я могу ее решить?

 Downloading https://docker.artifactory.enigma.com/artifactory/api/pypi/pypi/packages/packages/87/10/fdf5842f42834f6e3141668b607c07bc3c94de39acf582c3d4015e7a7fc5/PyICU-2.3.tar.gz (214 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /root/.pyenv/versions/3.6.10/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-lv3srr2x
       cwd: /tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/
  Complete output (53 lines):
  (running 'icu-config --version')
  (running 'pkg-config --modversion icu-i18n')
  Traceback (most recent call last):
    File "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 62, in <module>
      ICU_VERSION = os.environ['ICU_VERSION']
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/os.py", line 669, 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 "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 65, in <module>
      ICU_VERSION = check_output(('icu-config', '--version')).strip()
    File "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 18, in check_output
      return subprocess_check_output(popenargs)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 356, in check_output
      **kwargs).stdout
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 423, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 729, in __init__
      restore_signals, start_new_session)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 1364, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'icu-config': 'icu-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 68, in <module>
      ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
    File "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 18, in check_output
      return subprocess_check_output(popenargs)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 356, in check_output
      **kwargs).stdout
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 423, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 729, in __init__
      restore_signals, start_new_session)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 1364, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config': 'pkg-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-g23e769w/pyicu_fa1d77f63b4346f48975bf7f3d7508cc/setup.py", line 73, in <module>
      ''')
  RuntimeError:
  Please set the ICU_VERSION environment variable to the version of
  ICU you have installed.
  
  ----------------------------------------
WARNING: Discarding https://docker.artifactory.enigma.com/artifactory/api/pypi/pypi/packages/packages/87/10/fdf5842f42834f6e3141668b607c07bc3c94de39acf582c3d4015e7a7fc5/PyICU-2.3.tar.gz#sha256=419d389b014ee48f31014920f300c842df0770a283ab1fb4de82a6af334cac4d (from https://docker.artifactory.enigma.com/artifactory/api/pypi/pypi/simple/pyicu/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Downloading PyICU-2.3.tar.gz (214 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /root/.pyenv/versions/3.6.10/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-rv07hczd
       cwd: /tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/
  Complete output (53 lines):
  (running 'icu-config --version')
  (running 'pkg-config --modversion icu-i18n')
  Traceback (most recent call last):
    File "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 62, in <module>
      ICU_VERSION = os.environ['ICU_VERSION']
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/os.py", line 669, 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 "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 65, in <module>
      ICU_VERSION = check_output(('icu-config', '--version')).strip()
    File "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 18, in check_output
      return subprocess_check_output(popenargs)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 356, in check_output
      **kwargs).stdout
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 423, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 729, in __init__
      restore_signals, start_new_session)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 1364, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'icu-config': 'icu-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 68, in <module>
      ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
    File "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 18, in check_output
      return subprocess_check_output(popenargs)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 356, in check_output
      **kwargs).stdout
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 423, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 729, in __init__
      restore_signals, start_new_session)
    File "/root/.pyenv/versions/3.6.10/lib/python3.6/subprocess.py", line 1364, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config': 'pkg-config'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-g23e769w/pyicu_674899e91a7845b198565e0928c250ac/setup.py", line 73, in <module>
      ''')
  RuntimeError:
  Please set the ICU_VERSION environment variable to the version of
  ICU you have installed.
  
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/87/10/fdf5842f42834f6e3141668b607c07bc3c94de39acf582c3d4015e7a7fc5/PyICU-2.3.tar.gz#sha256=419d389b014ee48f31014920f300c842df0770a283ab1fb4de82a6af334cac4d (from https://pypi.org/simple/pyicu/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pyicu==2.3 (from versions: 0.8, 0.8.1, 0.9, 1.0, 1.0.1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 1.9.8, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.1, 2.2, 2.3, 2.3.1, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.5, 2.6, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8)
ERROR: No matching distribution found for pyicu==2.3
 

Комментарии:

1. Не могли бы вы предоставить файл Dockerfile или точный список команд для запуска в контейнере ubuntu: 20.04, который приведет к вышеуказанной ошибке. Простое выполнение команд apt не вызывает ошибку , которую вы указали.

2. Обнаружена эта ошибка , связанная с той же проблемой, и инструкции по установке pyicu в дистрибутивах на базе debian. Помогают ли они?

3. Спасибо @jabbson Я выполнил эти шаги раньше, но получил ошибку. Однако, возвращаясь к этому снова сегодня, я сократил свой Dockerfile для наследования ОТ ubuntu: 21.04 и запустил «apt-get install pkg-config libicu-dev amp;amp; pip install pyicu == 2.3» установка прошла успешно!

4. Я рад слышать, что вы поняли это!