Can't use letsencrypt-auto: ImportError: No module named _io

Hello,
I’ve heard of Let’s Encrypt on the EFF about a month ago. After seeing that the certificates were now trusted, I wanted to give it a try on my website.

However, when trying to open the letsencrypt-auto script, I encounter this issue:

mlp@MyLittlePC ~/letsencrypt % ./letsencrypt-auto
Updating letsencrypt and virtual environment dependencies...Traceback (most recent call last):
  File "/home/mlp/.local/share/letsencrypt/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/home/mlp/.local/share/letsencrypt/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 21, in <module>
    import io
  File "/usr/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: No module named _io

I’ve googled it all my afternoon, but all I could find was some topics about Ubuntu update, and virtual environment (I don’t know what it is, nor have I ever created one).

I use Debian, and recently upgraded from 7 to 8 by changing the lines in my sources.list.
I don’t know if the update broke it or anything else.

Thanks for reading.

Hi @mlp,

It seems like Python can’t “import io”, which is quite a basic thing that your Python setup should be able to do.

You can more directly run

python2.7 -c 'import io'

to see if this applies to your systemwide Python too. If so, I think something is broken on your system that predates your trying to use Let’s Encrypt. If not, then maybe we can ask someone who’s more familiar with the way the virtual environment gets set up to help figure out why the virtual environment didn’t end up with a working io module.

Thanks for your answer @Schoen

Unfortunately, when trying to “import io” or “import _io” in a python2.7 terminal, everything worked successfully.

mlp@MyLittlePC ~ % python2.7
Python 2.7.9 (default, Mar  1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> import _io
>>>

I don’t know what else could I do about this.

I’ve seen on github a “letsencrypt-nosudo” project that only generates a cert., guess I’ll have to go with it and automate it with cron.

Thanks for your help :slight_smile:

try
rm /home/mlp/.local/share/letsencrypt -R
./letsencrypt-auto

8 Likes

@Nemis Thank you, that worked perfectly well :smile:

Have a nice day :smile:

That worked like charm for me, Thanks @mlp @Nemis

My understanding is that starting with the newly-released 0.4.0 people should no longer have to delete virtualenvs in order to avoid this kind of problem. If you installed from a pre-0.4.0 version, you might have to do it one last time (if you encounter this specific error).

So I followed the advice in this thread (deleting ~.local/share/letsencrypt), and now when I run certbot-auto it asks me:

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: mydomain.net
2: subdomain.mydomain.net
3: myotherdomain.net
etc...

Obviously, I’ve already gone through a bunch of work setting up my various domains and subdomains (I have about a dozen) with letsencrypt. I’m not sure whether I need to do that again (I’d of course rather not), or whether there’s a way to copy over my old configuration. I did create a backup of my ~.local/share/letsencrypt folder, just in case I needed to copy anything out of it.

Do I need to go through the HTTPS activation process again for all of my domains, or can I copy over my old configuration?

Thanks!

EDIT: When I type certbot-auto certificates is lists all my existing certifcates and domains. So why when I run certbot-auto does it ask me to activate HTTPS again?

Every time you run certbot-auto with the default verb run, it assumes you ran it because you wanted a new certificate. To put it another way, the default action is to begin the process of acquiring a certificate.