Can't import MongoClient

That package is probably outdated or broken. Run sudo apt-get purge python-pymongo, then sudo apt-get install python-pip, then finally sudo pip install pymongo.


According to docs, MongoClient was introduced in version 2.4. As you installed pymongo from your distribution repository, it's quite possible it's not the most recent version. Try installing it via PiP (remove the one you have installed first):

pip install pymongo

I would like to suggest more robust answer:

pip show pymongo

now see where it direct you and from there simply remove the pymongo directory

rm -rf <the dir where pymongo lay>/pymongo*

Now, you can safely install pymongo again:

pip install pymongo