Certbot: setuptools pkg_resources pip wheel failed with error code 1

Created on 22 Apr 2016  ·  31Comments  ·  Source: certbot/certbot

./letsencrypt-auto --help
python is already the newest version (2.7.11-1).
python-dev is already the newest version (2.7.11-1).
dialog is already the newest version (1.3-20160209-1).
python-virtualenv is already the newest version (15.0.1+ds-3).
virtualenv is already the newest version (15.0.1+ds-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Checking for new version...
Creating virtual environment...
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in <module>
    main()
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main
    symlink=options.symlink)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment
    download=download,
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/administrator/...ncrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 1

OS Ubuntu 16.04 LTS
Clean os

certbot-auto

Most helpful comment

I resolved the issue by setting the locale variables. Without these, the script seems to break.
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

All 31 comments

same issue!

Some details: nginx installed and also php7.0 fpm, for the rest clean install

I solved it: just use "apt-get install letsencrypt". Super lame, but it works now

Same issue on ubuntu 16.04 with the client from git

I managed to get it working on Ubuntu 16.04 Server LTS. I deleted the apt-get installed setuptools, reinstalled with pip and it worked. If you get setuptools complaining about the locale, make sure you have locales set.

I resolved the issue by setting the locale variables. Without these, the script seems to break.
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

For those who might have a look at it, and compared to other configuration tasks to be initially done on ubuntu, configuring locales seems opaque. Which guide could one recommend ?

This helped me:

> locale-gen en_US en_US.UTF-8
> dpkg-reconfigure locales

same issue, apt-get install letsencrypt does not help to resolve that. To resolve that issue I had to:

~ # apt-get install python-pip
~ # pip install setuptools
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 215, in main
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python2.7/locale.py", line 581, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

then

~ # export LC_ALL="en_US.UTF-8"
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
~ # export LC_CTYPE="en_US.UTF-8"
~ # pip install setuptools
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

... then ...

~ # pip install --upgrade setuptools     
Collecting setuptools
  Downloading setuptools-29.0.1-py2.py3-none-any.whl (472kB)
    100% |████████████████████████████████| 481kB 3.0MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 20.7.0
    Not uninstalling setuptools at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed setuptools-29.0.1
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

now it works. So I assume "setuptools" in Ubuntu 16.04 LTS are just too old.

@chani thank you :)

Also works for ru_RU locale 🇷🇺

This helped me:

locale-gen en_US en_US.UTF-8
dpkg-reconfigure locales

I followed the solution given by @evgenity and its perfectly work.

This thread was helpful, thank you! I couldn't create a Virtual Environment with virtualenv for Python because of pip/locale issues. To fix it I went through everything everyone posted on here (especially reconfiguring the locale and installing pip setuptools)

Thanks again!

Seems this is a duplicate of #2887

I've tried the above solutions without solving the same problem.but i find some solution in "lnmp" about aliyun host problems . https://bbs.vpser.net/thread-16253-1-1.html#pid50671.
apt-get purge python-virtualenv python3-virtualenv virtualenv
pip install --upgrade pip
pip install virtualenv
vim /bin/lnmp
replace /bin/certbot certonly to /bin/certbot --no-bootstrap certonly

locale-gen en_US en_US.UTF-8 & locale-gen

Ubuntu 16.04 x64 Fixed issue by 2 step:

  1. apt-get install letsencrypt
  2. exoprt below
    export LC_ALL="en_US.UTF-8"
    export LC_CTYPE="en_US.UTF-8"

thanks!

Add --no-bootstrap to certbot command line helps for me.
It seems a problem with python versions. Python 2.7 works well on the whole process. So you should uninstall all python3 before running certbot. But some system use Python3 as default, and when you running virtualenv , Python3 and Python2 messed up.
I wonder why certbot use virtualenv?
I also suggest cerbot don't try to install packages because you don't know what python version of packages will be installed actually. And bring your own dependence binaries. Because sometime dependence is hell.

Setting the locales also worked for me. Is this considered an actual bug in certbot, a documentation issue, or a user error???

+1 on getting this documented OR fixed.

For me, It worked with this... Please read the error then follow any instructions.

$export LC_ALL="en_US.UTF-8"
$export LC_CTYPE="en_US.UTF-8"

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
$ sudo apt-get update

Replace $key with the corresponding $key from your GPG error.

for SSL certificate Signing with certbot using letsencrypt
$ certbot-auto certonly --standalone -d $DOMAIN --preferred-challenges http \
--agree-tos -n -m $EMAIL --keep-until-expiring

Debian 7 wheezy and starting to be fed up about this pythonesque stuff, I thought it would take 5 mn to use letsencrypt

First I got:

ImportError: No module named zlib

Which was solved using http://doc.biblissima-condorcet.fr/loris-setup-guide-ubuntu-debian 1.1

Now I have:

Traceback (most recent call last):
  File "/tmp/tmp.03OPotGaYT/fetch.py", line 21, in <module>
    import ssl
  File "/usr/local/lib/python2.7/ssl.py", line 60, in <module>
    import _ssl             # if we can't import it, let the error propagate

---> error 1

ImportError: /usr/local/lib/python2.7/lib-dynload/_ssl.so: undefined symbol: PyUnicodeUCS2_DecodeUTF8
WARNING: unable to check for updates.
Creating virtual environment...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2343, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 712, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 947, in create_environment
    download=download,
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 904, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 796, in call_subprocess
    % (cmd_desc, proc.returncode))



md5-bb51e965275c1f27f3d6938e64bf03f4



OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pip wheel failed with error code 1

What is this virtual env intended for? I have tried whatever is advised in this thread without success

It looks to be working now after using the instructions in last comment of https://stackoverflow.com/questions/42189878/pythonsetuptools-pkg-resources-pip-wheel-failed-with-error-code-1-error/42189903

Don't get very well why something that is supposed to ease the life of everybody is so complicate to install, would be much easier with a simple nodejs module

This error can be reproduced when index-url of pkg-resoures is set to the server without complete resources. This would happen to the user using cloud service with custom pip.conf. Update pip.conf would be a possible solution to this issue.

mv /root/.pip/pip.conf  /root/.pip/pip.conf.bk
vi /root/.pip/pip.conf 

insert following to pip.conf

[global]
index-url=https://pypi.python.org/simple/
[install]
trusted-host=pypi.python.org

Reference (Chinese website): https://blog.csdn.net/Tsinghua2MIT/article/details/79945625

I closed #2887 as a duplicate of this, but wanted to keep a link to yan12125's helpful comment.

Ubuntu 16.04 x64 Fixed issue by 2 step:

  1. apt-get install letsencrypt
  2. exoprt below
    export LC_ALL="en_US.UTF-8"
    export LC_CTYPE="en_US.UTF-8"

thanks!

I resolved problem by this method

I resolved the issue by following @wwboy6 answer.

This commands solved my problem:

sudo pip install --upgrade setuptools
sudo pip install --upgrade virtualenv
sudo pip install --upgrade pip

This commands solved my problem:

sudo pip install --upgrade setuptools
sudo pip install --upgrade virtualenv
sudo pip install --upgrade pip

thanks。This method solved my problem. The virtualenv's version is too old.

I would strongly advise against running sudo pip. A few of the reasons why are described at https://pages.charlesreid1.com/dont-sudo-pip/. Do not run the sudo pip install command at the top of that page on any system you care about.

I've tried allmost all hints from this page without success, include:
@knowThis: I've tried the above solutions without solving the same problem but...
apt-get purge python-virtualenv python3-virtualenv virtualenv
pip install virtualenv

and this doesn't help me. But then I did:
apt install python-virtualenv python3-virtualenv virtualenv
and it works.
(/etc/debian_version: 9.9 - but maybe the system is not properly updated yet, it was 8.x earlier and I just confirmed usage of new repos during apt update)

Was this page helpful?
0 / 5 - 0 ratings