11

Yesterday all was fine, but today, running the same command using certbot-auto to renew a certificate, I get this :

Upgrading certbot-auto 0.31.0 to 0.32.0...
Replacing certbot-auto...
Creating virtual environment...
Installing Python packages...    
/opt/eff.org/certbot/venv/bin/python: No module named pip.__main__; 'pip' is a package and cannot be directly executed
    Traceback (most recent call last):
      File "/tmp/tmp.eUWQ3w7cFV/pipstrap.py", line 177, in <module>
        sys.exit(main())
      File "/tmp/tmp.eUWQ3w7cFV/pipstrap.py", line 149, in main
        pip_version = StrictVersion(check_output([python, '-m', 'pip', '--version'])
      File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['/opt/eff.org/certbot/venv/bin/python', '-m', 'pip', '--version']' returned non-zero exit status 1

I'm on Debian 7.9... someone with the same problem ?

Vallica
  • 161
  • 1
  • 1
  • 9
  • 3
    [Certbot bugreport](https://github.com/certbot/certbot/issues/6824) with some workarounds (including Felipes answer). Closed as wontfix since it only applies to End-of-Life systems. – Marco Borchert May 20 '19 at 08:42

4 Answers4

23

It's a problem with the newest versions (>= 0.32.x) over Ubuntu 12.04 and Debian 7.5.

Just clone a previous branch (I used 0.30.x):

git clone --branch 0.30.x https://github.com/letsencrypt/letsencrypt

And use the option --no-self-upgrade when you run letsencrypt. In my case:

./letsencrypt-auto certonly --no-self-upgrade --standalone -d mydomain.com

Don't forget to add --no-self-upgrade to your renew cron job.

b4d
  • 143
  • 1
  • 9
Felipe Alonso
  • 413
  • 3
  • 9
2

I made the following 2 changes in certbot-auto script and it works

1st change

pip_version = StrictVersion(check_output([python, '-m', 'pip', '--version'])

to

pip_version = StrictVersion(check_output(['pip', '--version'])

2nd change

command = [python, '-m', 'pip', 'install', '--no-index', '--no-deps', '-U']

to

command = ['pip', 'install', '--no-index', '--no-deps', '-U']
Techie
  • 44,706
  • 42
  • 157
  • 243
0

It looks like this is happening in the process of upgrading your certbot package?

No module named pip.__main__; 'pip' is a package and cannot be directly executed

This might be a result of Python encountering a folder named pip in its include paths before finding the actual pip module. It's a bit tricky to debug this (you'd need to find out what Python's include paths are in this context, and then search these for the bad folder), but maybe you can fix the problem by removing and reinstalling the certbot-auto package.

(Your Debian version is pretty ancient, but the certbot version is not, and it's using virtualenv for its dependencies, so it's probably not that.)

Christoph Burschka
  • 4,467
  • 3
  • 16
  • 31
0

Don't forget to restart apache about Problem binding to port 80: Could not bind to IPv4 or IPv6.