Doppelganger Doppelganger - 1 month ago 13
Python Question

Python error: ImportError: cannot import name Akismet

I've seen many similar errors, but I can't see a solution that applies to my particular problem.

I'm trying to use the Akismet module which is on my PYTHONPATH, then if I start up the interactive interpreter, when I run

from akismet import Akismet
(as the docstring says), I get the following error:

from akismet import Akismet
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name Akismet

Answer

It will work perfectly if your PYTHONPATH is set correctly and globally (just tested it myself).

  • Must be set to the directory containing "akismet.py", not the file path! Make sure you don't use relative paths.
  • Note that you might need to reboot/logoff in order to apply environment variable changes to all programs.