Certbot auto started failing with ' No module named pip.__main__'

Hi,
I’m running with a bit of a problem on one of my old servers.
It’s an unbuntu 12.05 and it was never updated to a more recent release (and it actually needs to stay with that setup)

I run several domains on it and have been using certbot-auto for quite a while until recently I received emails about renewals that had not happened

I went to check, and apparently certbot-auto now fails when trying to create the virtual environment

I’m getting this error message: (sorry that system’s in french, 'est déjà la plus récente version disponible’n means is already the most recent version available.

augeas-lenses est déjà la plus récente version disponible.
gcc est déjà la plus récente version disponible.
libaugeas0 est déjà la plus récente version disponible.
libffi-dev est déjà la plus récente version disponible.
python-virtualenv est déjà la plus récente version disponible.
ca-certificates est déjà la plus récente version disponible.
libssl-dev est déjà la plus récente version disponible.
openssl est déjà la plus récente version disponible.
python est déjà la plus récente version disponible.
python-dev est déjà la plus récente version disponible.
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
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.xwWeTUnj39/pipstrap.py", line 177, in <module>
        sys.exit(main())
      File "/tmp/tmp.xwWeTUnj39/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 Goggled and found similar problem, all related to python/pip, but none (as of yet) that could relate to this particular situation with certbot-auto

The python certbot-auto installed is 2.7.

I’m guessing it was a botched auto update (i’m running it on a nightly cron with):
/root/certbot-auto renew --standalone --pre-hook "service apache2 stop" --post-hook "service apache2 start" and as it tries to self update before installing, it could have happened then…

Still some certificates are gonna be closing up real soon, and I need to renew those, so anybody got an idea (or a pointer towards a solution that i failed to find) of what might have happen and how to correct the situation , That’d be great help. Thanks in advance.

Hi @ericb2038

there are some threads with the same error message.

Check

Hi Juergenn Thank you so much, downgrading certbot-auto to 0.31 was indeed the solution :slight_smile:

Here’s the link if someone stumbles on this post with the same problem

https://github.com/certbot/certbot/issues/6824#issuecomment-470440436,

or the solution directly:

rm ./certbot-auto*
wget https://raw.githubusercontent.com/certbot/certbot/75499277be6699fd5a9b884837546391950a3ec9/certbot-auto
chmod +x ./certbot-auto
./certbot-auto --no-self-upgrade
5 Likes

A little update, there is an original topic there:

This gives the solution above, and another one involving patching current version (0.32), to make it work as intended.

1 Like

Thank you! , this really saved the day for us!

1 Like

Same thing here ! Worked like a charm and got us out of trouble. Thanks a lot

does anybody knows if it’s possible to configure --no-self-upgrade system-wide without passing the parameter all times? I’ve an installation of ISPConfig and I don’t know where cerbot is called from…

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