Certbot Error while running on CentOS. Error: pkg_resources.DistributionNotFound: mock


I have installed certbot on my CentOS 7 VPS server using the command # *yum install certbot* after installation got the message Package certbot-1.11.0-2.el7.noarch already installed and latest version

And when trying to run # certbot command on my server getting the following error.

Traceback (most recent call last):
  File "/usr/bin/certbot", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3007, in <module>
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 728, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: mock

mock package is already installed on my server # rpm -qa |grep mock easymock2-2.5.2-12.el7.noarch python2-mock-1.0.1-10.el7.noarch

Any solution to install and run certbot ?

1 Like

The latest Certbot 1.32.0 Release, what version do you have?
Likely need to use a newer version of Python; see Set up a Python virtual environment on Certbot Instructions | Certbot

1 Like

Looks like yum installs:


On the link shown for Certbot environment seems to indicate Python3.


Thanks for the updates


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