“AttributeError: ‘module’ object has no attribute ‘MongoClient’” error with Pymongo in Ubuntu 12.04

Eneko
enekochan
Published in
1 min readDec 5, 2013

I’m currently doing the M101P: MongoDB for Developers online course.

I had this error while running one of the homeworks with pymongo in Ubuntu 12.04:

AttributeError: 'module' object has no attribute 'MongoClient'

I had previously installed pymongo with apt-get like this:

sudo apt-get install python-pymongo

It looks like the package is outdated or broken so I had to remove the pymongo I had installed before and reinstall it using PiP:

sudo apt-get purge python-pymongo
sudo apt-get install python-pip
sudo pip install pymongo

Ref: http://stackoverflow.com/questions/17624416/cant-import-mongoclient

--

--