Unable to import Python's email module at all

Viewed 64287

I can't seem to import the email module at all. Every time I do it I get an error. I've tried uninstalling Python and reinstalling, but the email module just refuses to work. I've even done "pip install email" and it's still broken. I'm on Windows 7 Home Premium x64, running an x86 version of Python.

Here's what happens:

c:\Users\Nicholas\Desktop>python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "email.py", line 1, in <module>
    import smtplib
  File "C:\Python27\lib\smtplib.py", line 46, in <module>
    import email.utils
ImportError: No module named utils
>>>

EDIT: I've tried both Python from python.org and ActivePython, thinking ActivePython might work. Is there anyway to completely remove python and all its data and start 100% fresh maybe?

6 Answers

If none of the posted solution works, try the following:

(Use the combo python3 / pip3 OR python / pip and try not to mix those)

  1. Delete your current virtual environment directory.
  2. Create new virtual environment and activate it with 'source'.
  3. If exist, run the <pip install -r requirements.txt>.
  4. Install any missing packages with pip or pip3.
  5. Run the application to see if that solved the problem.
Related