Error pkg_resources.DistributionNotFound when trying generate valid certificate


#1

My domain is: guenoel.fr

I ran this command:

https://www.palabritudes.net/2018/03/11/certbot-challenge-dns-gandi-ovh.html

sudo /usr/bin/certbot certonly --manual \
                          --manual-public-ip-logging-ok \
                          --manual-auth-hook "/etc/letsencrypt/lexicon-ovh.sh create" \
                          --manual-cleanup-hook "/etc/letsencrypt/lexicon-ovh.sh delete" \
                          --preferred-challenges dns \
                          -d guenoel.fr \
                          -d www.guenoel.fr

It produced this output:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for guenoel.fr
dns-01 challenge for www.guenoel.fr
Hook command "/etc/letsencrypt/lexicon-ovh.sh create" returned error code 255
Error output from lexicon-ovh.sh:
Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests-file>=1.4' distribution was not found and is required by tldextract

Hook command "/etc/letsencrypt/lexicon-ovh.sh create" returned error code 255
Error output from lexicon-ovh.sh:
Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests-file>=1.4' distribution was not found and is required by tldextract

Waiting for verification...
Cleaning up challenges
Hook command "/etc/letsencrypt/lexicon-ovh.sh delete" returned error code 255
Error output from lexicon-ovh.sh:
Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests-file>=1.4' distribution was not found and is required by tldextract

Hook command "/etc/letsencrypt/lexicon-ovh.sh delete" returned error code 255
Error output from lexicon-ovh.sh:
Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 655, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 963, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'requests-file>=1.4' distribution was not found and is required by tldextract

Failed authorization procedure. guenoel.fr (dns-01): urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.guenoel.fr, www.guenoel.fr (dns-01): urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.www.guenoel.fr

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: guenoel.fr
   Type:   None
   Detail: DNS problem: NXDOMAIN looking up TXT for
   _acme-challenge.guenoel.fr

   Domain: www.guenoel.fr
   Type:   None
   Detail: DNS problem: NXDOMAIN looking up TXT for
   _acme-challenge.www.guenoel.fr

My web server is (include version): VMware at home

The operating system my web server runs on is (include version): Debian (stretch)

My hosting provider, if applicable, is: OVH

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):


#2

Hi,

I believe certbot would only execute a script, without arguments, which means you need to create a file that only have one function…

Thank you


#3

Certbot manual auth hooks can have arguments. :slight_smile:

I don’t know how this should be fixed, though.

I note that the tutorial was using Python 3, but you’re using Python 2.