Skip to content

setuptools pkg_resources pip wheel failed with error code 2 #46

Closed
@joomlagate

Description

@joomlagate

Today I tried this script on a fresh installation of latest VestaCP 0.98-17 version. After VestaCP was installed, I created a new website (domain), without uploading any file.

Then I followed the installation guide of your script at:

https://github.com/interbrite/letsencrypt-vesta/blob/master/README.md

I exactly ran through those 5 steps in the "Installation" section. When running the 5th step, I got errors at the end:

#letsencrypt-vesta myusername joomlagate.com
Bootstrapping dependencies for Debian-based OSes...
Hit:1 http://mirrors.aliyuncs.com/ubuntu xenial InRelease
Hit:2 http://mirrors.aliyun.com/ubuntu xenial InRelease
Get:3 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [102 kB]
Get:4 http://mirrors.aliyuncs.com/ubuntu xenial-security InRelease [102 kB]
Get:5 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [102 kB]
Get:6 http://mirrors.aliyuncs.com/ubuntu xenial-updates InRelease [102 kB]
Get:7 http://mirrors.aliyun.com/ubuntu xenial-proposed InRelease [253 kB]
Get:8 http://mirrors.aliyuncs.com/ubuntu xenial-proposed InRelease [253 kB]
Get:9 http://mirrors.aliyun.com/ubuntu xenial-backports InRelease [102 kB]
Get:10 http://mirrors.aliyuncs.com/ubuntu xenial-backports InRelease [102 kB]
Get:11 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 Packages [378 kB]
Get:12 http://mirrors.aliyuncs.com/ubuntu xenial-updates/universe amd64 Packages [378 kB]
Get:13 http://mirrors.aliyun.com/ubuntu xenial-updates/universe i386 Packages [373 kB]
Get:14 http://mirrors.aliyuncs.com/ubuntu xenial-updates/universe i386 Packages [373 kB]
Hit:15 http://apt.vestacp.com/xenial xenial InRelease
Hit:16 http://nginx.org/packages/mainline/ubuntu xenial InRelease
Fetched 2,623 kB in 1s (1,655 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
augeas-lenses is already the newest version (1.4.0-0ubuntu1).
ca-certificates is already the newest version (20160104ubuntu1).
gcc is already the newest version (4:5.3.1-1ubuntu1).
libaugeas0 is already the newest version (1.4.0-0ubuntu1).
libffi-dev is already the newest version (3.2.1-4).
python is already the newest version (2.7.11-1).
python-dev is already the newest version (2.7.11-1).
libssl-dev is already the newest version (1.0.2g-1ubuntu4.5).
openssl is already the newest version (1.0.2g-1ubuntu4.5).
python-virtualenv is already the newest version (15.0.1+ds-3ubuntu1).
virtualenv is already the newest version (15.0.1+ds-3ubuntu1).
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic
linux-image-extra-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Creating virtual environment...
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2363, in
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 /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
Let's Encrypt returned an error status. Aborting.

Why? How to fix this?

My server OS is Ubuntu server 16.04.1 LTS 64-bit.

Thank you.

Activity

joomlagate

joomlagate commented on Jan 17, 2017

@joomlagate
Author

Well, finally I solved this problem myself. After some Googling, I realized that : my pip version is old, it need to be upgraded to the latest version.

  1. how to check your pip version:
    # pip -V

  2. my pip version is 8.1.1, but the latest version is 9.0.1, so I ran following command to upgrade it:
    # pip install --upgrade pip

  3. Now check the pip version again:

# pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
  1. Now I can install the letsencrypt-vesta script and run following command:

# letsencrypt-vesta USERNAME DOMAIN

Hope the author of letsencrypt-vesta will add a new feature of "automatically detect pip version and upgrade it if needed", this will avoid above mentioned errors.

Thank you.

willin

willin commented on Mar 1, 2017

@willin

@baijianpeng

OSError: Command /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
➜  ~ pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
firejq

firejq commented on May 13, 2017

@firejq

I update my pip but there is still such a error.
OSError: Command /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2

--> pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

Young1993

Young1993 commented on May 25, 2017

@Young1993

my server
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
there is still such a error.
OSError: Command /root/.local/share/letsencrypt/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2

ghost

ghost commented on Jul 12, 2017

@ghost

how to fix this???
$pip install --upgrade pip
Collecting pip
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Young1993

Young1993 commented on Jul 24, 2017

@Young1993
leadscloud

leadscloud commented on Nov 8, 2017

@leadscloud

i solved.

if you have install python3, remove it.
apt-get purge python-virtualenv python3-virtualenv virtualenv

but, if you also have error. upgrade your pip with

wget https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz
tar -xzvf pip-8.1.2.tar.gz
cd pip-8.1.2
sudo python setup.py install
sudo -H pip install --upgrade pip

then

pip install virtualenv

joomlagate

joomlagate commented on Dec 23, 2017

@joomlagate
Author

@Young1993 @sbmzhcn

Why we have to remove python3? It was said that Certbot ALREADY support python3 since May 2017, see: certbot/certbot#3179

And, we know that Ubuntu Server 16.04 installs both Python 2.7 and Python 3.5 .

Why we can not find a way to let letsencrypt-vesta script use the "python 3 support" feature of Certbot ?

Since I am not a programmer, hope some here will find a way to solve this issue perfectly.

Thank you.

thryb

thryb commented on Apr 18, 2018

@thryb

No need to uninstall anything. This will fix your issue.

sudo apt-get install python-setools
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @leadscloud@joomlagate@willin@Young1993@thryb

        Issue actions

          setuptools pkg_resources pip wheel failed with error code 2 · Issue #46 · interbrite/letsencrypt-vesta