Installing PyICU on continuumio/miniconda3:4.9.2 image

434 views Asked by At

Unfortunately when using the Docker base: continuumio/miniconda3:4.9.2 from https://hub.docker.com/r/continuumio/miniconda3 and running: pip install PyICU==2.4.2 I get this error:

------                                                                                                                      
 > [ 5/10] RUN pip install PyICU==2.4.2:                                                                                    
#9 0.864 Collecting PyICU==2.4.2                                                                                            
#9 2.275   Downloading PyICU-2.4.2.tar.gz (219 kB)                                                                          
#9 3.115     ERROR: Command errored out with exit status 1:                                                                 
#9 3.115      command: /opt/conda/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k004hem9/pyicu/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k004hem9/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 /tmp/pip-pip-egg-info-bze17p9f
#9 3.115          cwd: /tmp/pip-install-k004hem9/pyicu/
#9 3.115     Complete output (53 lines):
#9 3.115     Package icu-i18n was not found in the pkg-config search path.
#9 3.115     Perhaps you should add the directory containing `icu-i18n.pc'
#9 3.115     to the PKG_CONFIG_PATH environment variable
#9 3.115     No package 'icu-i18n' found
#9 3.115     Traceback (most recent call last):
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 62, in <module>
#9 3.115         ICU_VERSION = os.environ['ICU_VERSION']
#9 3.115       File "/opt/conda/lib/python3.8/os.py", line 675, in __getitem__
#9 3.115         raise KeyError(key) from None
#9 3.115     KeyError: 'ICU_VERSION'
#9 3.115     
#9 3.115     During handling of the above exception, another exception occurred:
#9 3.115     
#9 3.115     Traceback (most recent call last):
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 65, in <module>
#9 3.115         ICU_VERSION = check_output(('icu-config', '--version')).strip()
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 18, in check_output
#9 3.115         return subprocess_check_output(popenargs)
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 411, in check_output
#9 3.115         return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 489, in run
#9 3.115         with Popen(*popenargs, **kwargs) as process:
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 854, in __init__
#9 3.115         self._execute_child(args, executable, preexec_fn, close_fds,
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 1702, in _execute_child
#9 3.115         raise child_exception_type(errno_num, err_msg, err_filename)
#9 3.115     FileNotFoundError: [Errno 2] No such file or directory: 'icu-config'
#9 3.115     
#9 3.115     During handling of the above exception, another exception occurred:
#9 3.115     
#9 3.115     Traceback (most recent call last):
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 68, in <module>
#9 3.115         ICU_VERSION = check_output(('pkg-config', '--modversion', 'icu-i18n')).strip()
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 18, in check_output
#9 3.115         return subprocess_check_output(popenargs)
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 411, in check_output
#9 3.115         return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
#9 3.115       File "/opt/conda/lib/python3.8/subprocess.py", line 512, in run
#9 3.115         raise CalledProcessError(retcode, process.args,
#9 3.115     subprocess.CalledProcessError: Command '('pkg-config', '--modversion', 'icu-i18n')' returned non-zero exit status 1.
#9 3.115     
#9 3.115     During handling of the above exception, another exception occurred:
#9 3.115     
#9 3.115     Traceback (most recent call last):
#9 3.115       File "<string>", line 1, in <module>
#9 3.115       File "/tmp/pip-install-k004hem9/pyicu/setup.py", line 70, in <module>
#9 3.115         raise RuntimeError('''
#9 3.115     RuntimeError:
#9 3.115     Please install pkg-config on your system or set the ICU_VERSION environment
#9 3.115     variable to the version of ICU you have installed.
#9 3.115     
#9 3.115     (running 'icu-config --version')
#9 3.115     (running 'pkg-config --modversion icu-i18n')
#9 3.115     ----------------------------------------
#9 3.115 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I have tried to install these packages as well however have had no luck:

RUN apt-get update
RUN apt-get install -y sudo build-essential pkg-config gcc awscli jq vim 

Does anyone know what config I am missing / what packages I need to add?

1

There are 1 answers

0
phd On

PyICU is a Python wrapper around the C++ ICU library. You need to install said library first:

apt-get install libicu-dev

See also https://gitlab.pyicu.org/main/pyicu#installing-pyicu