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

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

You might also like

Solve “mongodb cannot be built while v8 is active” in MacPorts
While updating all the ports of macports I got this error: ---> Configuring mongodb Error: mongodb...
MongoDB: Recover Data after an Unexpected Shutdown in Ubuntu
If you try to run mongod but it fails to start and have this error in the log file (/var/log/mongodb/mongodb.log)...
Install MongoDB in Ubuntu 12.04 with PHP driver
Install MongoDB: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 echo...
Install and configure MongoDB and PHP driver with MacPorts
Installing and configuring MongoDB with MacPorts Installing MongoDB with MacPorts is as easy as...
Leave a comment ?


Leave a Comment