Alpine Linux Python Missing py-argparse - Unable to Install Certbot


#1

After installing certbot from both Brew and Port on Mac, getting these errors even after just issuing “certbot” by itself:

Traceback (most recent call last):
File “/opt/local/bin/certbot”, line 6, in
from pkg_resources import load_entry_point
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 3036, in
@_call_aside
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 3020, in _call_aside
f(*args, **kwargs)
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 3049, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 654, in _build_master
ws.require(requires)
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 968, in require
needed = self.resolve(parse_requirements(requirements))
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources/init.py”, line 854, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘argparse’ distribution was not found and is required by certbot

Has anyone had any similar issue?


#2

updates:

Installed ‘argparse’ with easy_install. No difference.
Installed ‘virtualenv’, just because I saw that mentioned. No difference.
Checked that argparse is in sys.path. Yes it is. No difference.

I did notice that brew installed python2.7 again onto my machine and created links in /usr/local/bin, however the certbot script has hard-coded a link to the system version. I’m assuming when I do easy_install or pip, it’s using the versions returned by the path (/usr/local/bin/xxx), however certbot is calling the system version. I don’t believe the two would share installations, right?


#3

Same problem here, updated certbot this morning on archlinux (arm). Even a certbot --version is not working anymore.

Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3036, in <module>
    @_call_aside
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3020, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3049, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 654, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'argparse' distribution was not found and is required by certbot

#4

On arch: Install python2-argparse


#5

This fixed it. Thank you :bouquet:


#6

This error happens on a new Alpine Linux edge installation. It happened to me after an apk upgrade.
The workaround is to use alpine 3.5 (3.5.2) instead. However, certbot has a newer version on edge than on 3.5.2, so when I copied /etc/letsencrypt from the broken edge system to a new Alpine 3.5 system, and then run “certbot renew --dry-run”, I got warnings:
Attempting to parse the version 0.11.1 renewal configuration file found at /etc/letsencrypt/renewal/{domain}.conf with version 0.9.3 of Certbot. This might not work.

I would prefer using a newer version of certbot. Version 0.9.3 does not have the “certificates” command.

Here’s the error on Alpine edge (same as reported for archlinux, but with slightly different line numbers), which I install using LXD on Ubuntu 16.04:
lxc launch images:alpine/edge/amd64 edge
lxc exec edge ash
# apk add certbot
# certbot --version
Traceback (most recent call last):
File “/usr/bin/certbot”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3019, in
@_call_aside
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3003, in _call_aside
f(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3032, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 655, in _build_master
ws.require(requires)
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 963, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 849, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘argparse’ distribution was not found and is required by certbot


#7

Does my solution help?


#8

Installing argparse doesn’t work on Alpine Linux, because it is already installed.
The argparse packages available on the Alpine edge main and community repositories are:
py3-configargparse-0.11.0-r1
py-configargparse-0.11.0-r1
py2-configargparse-0.11.0-r1

py-configargparse and py2-configargparse are already installed with certbot.


Alpine linux error with certbot - rfc3339 library not detected
#9

It’s now fixed on Alpine edge: https://bugs.alpinelinux.org/issues/7179 They added the py-argparse package and a dependency to it. It may not be available on all mirrors yet.


#10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.