Certbot Not working with CentOS7 and Nginx


#1

Hi,

I just tried installing certbot on my new server which is running centos7 but it seems to be giving me error, can anyone help me rectify the error.

My domain is: www.rigpl.com

I ran this command: yum install certbot-nginx , certbot --nginx

It produced this output:

Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==0.19.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 570, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2409, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2415, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 16, in <module>
    from certbot import account
  File "/usr/lib/python2.7/site-packages/certbot/account.py", line 17, in <module>
    from acme import messages
  File "/usr/lib/python2.7/site-packages/acme/messages.py", line 5, in <module>
    from acme import challenges
  File "/usr/lib/python2.7/site-packages/acme/challenges.py", line 10, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/usr/lib/python2.7/site-packages/requests/utils.py", line 32, in <module>
    from .exceptions import InvalidURL
  File "/usr/lib/python2.7/site-packages/requests/exceptions.py", line 10, in <module>
    from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
  File "/usr/lib/python2.7/site-packages/requests/packages/__init__.py", line 95, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'requests.packages.urllib3'

My web server is (include version): nginx version: nginx/1.12.2

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

   Static hostname: www.rigpl.com
         Icon name: computer-server
           Chassis: server
        Machine ID: 9cf841f837ed4d74b749acfe0a6600fe
           Boot ID: f4126e1702d54f11a2cb9c39bbefb2cc
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-693.5.2.el7.x86_64
      Architecture: x86-64

My hosting provider, if applicable, is: I am using a baremetal server

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): SSH Shell


#2

Well found the solution it turns out that the latest version of urllib3 v1.22 was not compatible, I uninstalled urllib3 v1.22 and then installed v1.21.1 Step to install

Check urllib3 version by using command pip freeze

acme==0.19.0
ansible==2.3.1.0
asn1crypto==0.23.0
backports.ssl-match-hostname==3.4.0.2
bcrypt==3.1.4
-e git+https://github.com/frappe/bench@9c150732977a15074f2a2f720c52fb5c5bf6947a#egg=bench
certbot==0.19.0
certbot-nginx==0.19.0
certifi==2017.7.27.1
cffi==1.11.2
chardet==3.0.4
click==6.7
ConfigArgParse==0.11.0
configobj==4.7.2
cryptography==2.1.2
cssselect==1.0.1
decorator==3.4.0
enum34==1.1.6
fail2ban==0.9.7
future==0.16.0
gitdb==0.6.4
GitPython==0.3.2rc1
honcho==1.0.1
idna==2.6
iniparse==0.4
ipaddress==1.0.18
IPy==0.75
Jinja2==2.9.6
kitchen==1.1.1
langtable==0.0.31
lxml==4.1.1
Magic-file-extensions==0.2
MarkupSafe==1.0
meld3==0.6.10
mock==1.0.1
MySQL-python==1.2.5
ndg-httpsclient==0.3.2
paramiko==2.3.1
parsedatetime==1.5
perf==0.1
ply==3.4
policycoreutils-default-encoding==0.1
psutil==5.4.0
pyasn1==0.3.7
pycparser==2.18
pycrypto==2.6.1
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
pyliblzma==0.5.3
PyNaCl==1.1.2
pyOpenSSL==0.13.1
pyparsing==1.5.6
pyRFC3339==1.0
python-augeas==0.5.0
python-crontab==2.2.6
python-dateutil==2.6.1
python-dmidecode==3.12.2
python-linux-procfs==0.4.9
python2-pythondialog==3.3.0
pytz==2016.10
pyudev==0.15
pyxattr==0.5.1
PyYAML==3.12
requests==2.18.4
s3cmd==1.6.1
schedutils==0.4
semantic-version==2.6.0
seobject==0.1
sepolicy==1.1
six==1.9.0
slip==0.4.0
slip.dbus==0.4.0
smmap==0.9.0
supervisor==3.1.4
urlgrabber==3.10
urllib3==1.22
virtualenv==15.1.0
yum-langpacks==0.4.2
yum-metadata-parser==1.1.4
zope.component==4.1.0
zope.event==4.0.3
zope.interface==4.0.5

Uninstall v1.22 of urllib3 by using command pip uninstall urllib3

Now Install urllib3 v1.21.1 by using command pip install -Iv https://github.com/shazow/urllib3/archive/1.21.1.tar.gz

Now the problem is gone.
Just answering my question for future reference for others.


#3

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