httpie throws exception when run due to version conflict with idna
On Alpine 3.8, installing the httpie package results in idna 2.7 being installed, which doesn’t meet the requirement ‘idna<2.7,>=2.5’, resulting in an exception.
<code class="text">
▸ ~ docker run -it --rm alpine:3.8 ash
/ # apk add --no-cache httpie
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/18) Installing libbz2 (1.0.6-r6)
(2/18) Installing expat (2.2.5-r0)
(3/18) Installing libffi (3.2.1-r4)
(4/18) Installing gdbm (1.13-r1)
(5/18) Installing xz-libs (5.2.4-r0)
(6/18) Installing ncurses-terminfo-base (6.1_p20180818-r1)
(7/18) Installing ncurses-terminfo (6.1_p20180818-r1)
(8/18) Installing ncurses-libs (6.1_p20180818-r1)
(9/18) Installing readline (7.0.003-r0)
(10/18) Installing sqlite-libs (3.24.0-r0)
(11/18) Installing python3 (3.6.6-r0)
(12/18) Installing py3-chardet (3.0.4-r0)
(13/18) Installing py3-idna (2.7-r0)
(14/18) Installing py3-certifi (2018.4.16-r0)
(15/18) Installing py3-urllib3 (1.22-r0)
(16/18) Installing py3-requests (2.18.4-r0)
(17/18) Installing py3-pygments (2.2.0-r0)
(18/18) Installing httpie (0.9.9-r1)
Executing busybox-1.28.4-r0.trigger
OK: 77 MiB in 31 packages
/ # http
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 574, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (idna 2.7 (/usr/lib/python3.6/site-packages), Requirement.parse('idna<2.7,>=2.5'), {'requests'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/http", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3088, in <module>
@_call_aside
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3072, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 576, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 589, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'idna<2.7,>=2.5' distribution was not found and is required by requests
</code>
Manually installing an older version of idna does allow it to work.
<pre><code class="text">
/ # easy_install-3.6 idna==2.6
Searching for idna==2.6
Reading https://pypi.python.org/simple/idna/
Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl#sha256=8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4
Best match: idna 2.6
Processing idna-2.6-py2.py3-none-any.whl
Installing idna-2.6-py2.py3-none-any.whl to /usr/lib/python3.6/site-packages
Adding idna 2.6 to easy-install.pth file
Installed /usr/lib/python3.6/site-packages/idna-2.6-py3.6.egg
Processing dependencies for idna==2.6
Finished processing dependencies for idna==2.6
/ # http
usage: http [--json] [--form] [--pretty {all,colors,format,none}]
[--style STYLE] [--print WHAT] [--headers] [--body] [--verbose]
[--all] [--history-print WHAT] [--stream] [--output FILE]
[--download] [--continue]
[--session SESSION_NAME_OR_PATH | --session-read-only SESSION_NAME_OR_PATH]
[--auth USER[:PASS]] [--auth-type {basic,digest}]
[--proxy PROTOCOL:PROXY_URL] [--follow]
[--max-redirects MAX_REDIRECTS] [--timeout SECONDS]
[--check-status] [--verify VERIFY]
[--ssl {ssl2.3,tls1,tls1.1,tls1.2}] [--cert CERT]
[--cert-key CERT_KEY] [--ignore-stdin] [--help] [--version]
[--traceback] [--default-scheme DEFAULT_SCHEME] [--debug]
[METHOD] URL [REQUEST_ITEM [REQUEST_ITEM ...]]
http: error: the following arguments are required: URL
</code>
(from redmine: issue id 9416, created on 2018-09-12)