Python: no module named datetime?

Solution 1:

This just happened to me after the 14.10 update, and it seems to be because my virtual environments have old copies of /usr/bin/python2.7 that — unlike the new binary — do not include datetime built-in, and so get an error when they cannot find it on disk anywhere. The new interpreter seems to import it without any file I/O (try running it under strace to check).

I fixed each virtual environment by activating it and running:

$ cp /usr/bin/python2.7 $(which python2.7)

Solution 2:

You can just reinitialize the virtualenv by:

cd $VIRTUAL_ENV
virtualenv .

Solution 3:

If you're getting this trying to use letsencrypt after an upgrade, this solution worked for me letsencrypt forums - Can't use auto import: error: no module named io/2345/3

I just had to delete this:

rm ~/.local/share/letsencrypt -R