Cert renew , error with python packages(utf8)

Hi :
when i renew my cert today, it’s failed.
anyone can help me ? thank you.

/usr/local/letsencrypt/letsencrypt-auto certonly --apache --renew-by-default -d www2.nicklee.tw
Creating virtual environment…
Installing Python packages…
Had a problem while installing Python packages.

pip prints the following errors:

Exception:
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/commands/install.py”, line 272, in run
with self._build_session(options) as session:
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 329, in init
self.headers[“User-Agent”] = user_agent()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 93, in user_agent
from pip._vendor import distro
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 1050, in
_distro = LinuxDistribution()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 594, in init
if include_lsb else {}
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 922, in _get_lsb_release_info
stdout, stderr = stdout.decode(‘utf-8’), stderr.decode(‘utf-8’)
File “/opt/eff.org/certbot/venv/lib64/python2.7/encodings/utf_8.py”, line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xa1 in position 20: invalid start byte

Certbot has problem setting up the virtual environment.

We were not be able to guess the right solution from your pip
output.

Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment
for possible solutions.
You may also find some support resources at https://certbot.eff.org/support/ .

My operating system is (include version):
Linux www2.nicklee.tw 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

CentOS Linux release 7.2.1511 (Core)

My web server is (include version):
Apache/2.4.6 (CentOS)
mysql Ver 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1
PHP 5.6.20 (cli) (built: Apr 2 2016 07:51:15)

Hmmmm…
Which certbot version?
Do you have multiple version of python installed?
Have you tried upgrading the version of PIP?

This was previously reported in August:

It's actually a bug in one of Certbot's dependencies, pip, and it has been fixed.

See especially this post by @bmw:

Since our release at the beginning of August, we install pip 9.0.1 which should include a fix for this. The problem may be occurring when we try to install the new pip version though.

If you can reproduce, I’d be interested to know the instructions for doing so, the output of grep -m1 LE_AUTO_VERSION /path/to/certbot-auto, and the output of path/to/certbot-auto --verbose.

I wonder if you're stuck with an older version of certbot-auto and pip, which now has trouble upgrading itself...

Could you post the information requested in that quote?

Running "LANG=C /usr/local/letsencrypt/letsencrypt-auto certonly --apache --renew-by-default -d www2.nicklee.tw" (overriding the language setting) once may allow Certbot and pip to upgrade, and then it would work normally in the future.

Hi rg305 :
Thank you.
my certbot version :0.19.0

 python just only one (2.7.5) 

 pip version :i upgrade to latest version.
 pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)

Hi bmw :
Thanks for your help.
here is the output of these command.

grep -m1 LE_AUTO_VERSION /usr/local/letsencrypt/certbot-auto

LE_AUTO_VERSION=“0.19.0”

#/usr/local/letsencrypt/certbot-auto --verbose
Creating virtual environment…
Running virtualenv with interpreter /bin/python2.7
New python executable in /opt/eff.org/certbot/venv/bin/python2.7
Also creating executable in /opt/eff.org/certbot/venv/bin/python
Installing Setuptools…done.
Installing Pip…done.
Installing Python packages…
Exception:
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/commands/install.py”, line 272, in run
with self._build_session(options) as session:
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 329, in init
self.headers[“User-Agent”] = user_agent()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 93, in user_agent
from pip._vendor import distro
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 1050, in
_distro = LinuxDistribution()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 594, in init
if include_lsb else {}
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 922, in _get_lsb_release_info
stdout, stderr = stdout.decode(‘utf-8’), stderr.decode(‘utf-8’)
File “/opt/eff.org/certbot/venv/lib64/python2.7/encodings/utf_8.py”, line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xa1 in position 20: invalid start byte
Had a problem while installing Python packages.

#LANG=C /usr/local/letsencrypt/letsencrypt-auto certonly --apache --renew-by-default -d www2.nicklee.tw
Creating virtual environment…
Installing Python packages…
Had a problem while installing Python packages.

pip prints the following errors:

Exception:
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/commands/install.py”, line 272, in run
with self._build_session(options) as session:
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/basecommand.py”, line 72, in _build_session
insecure_hosts=options.trusted_hosts,
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 329, in init
self.headers[“User-Agent”] = user_agent()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/download.py”, line 93, in user_agent
from pip._vendor import distro
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 1050, in
_distro = LinuxDistribution()
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 594, in init
if include_lsb else {}
File “/opt/eff.org/certbot/venv/lib/python2.7/site-packages/pip/_vendor/distro.py”, line 922, in _get_lsb_release_info
stdout, stderr = stdout.decode(‘utf-8’), stderr.decode(‘utf-8’)
File “/opt/eff.org/certbot/venv/lib64/python2.7/encodings/utf_8.py”, line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xa1 in position 20: invalid start byte

Certbot has problem setting up the virtual environment.

We were not be able to guess the right solution from your pip
output.

Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment
for possible solutions.
You may also find some support resources at https://certbot.eff.org/support/ .

Well. I'm sorry, but i don't have many other ideas.

Note that Certbot has a separate copy of pip. It could be a different version.

I don't know if i'm right about the issue or not, but i don't know what to do next.

A brute-force option is to move or delete /opt/eff.org/certbot/ to make it reinstall itself anew. But i don't know if it will help.

For now, running Certbot with "--no-self-upgrade" should let it run, but that's not a tenable solution in the long term.

(Edit: "move or delete"! Not "remove or delete"!)

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