Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failure to import pymongo ubuntu

I am currently runnning Ubuntu 12.04 with mongodb 2.2 and pymongo version 2.3. I am attempting to gather some information using Twitters API and I am getting an error when attempting to import mymongo. Here is what I have:

import pycurl, json
import pymongo


STREAM_URL = "https://stream.twitter.com/1/statuses/filter.json"
WORDS = "track=#obama"
USER = "myuser"
PASS = "mypass"

ImportError: No module named pymongo Any ideas?

like image 421
bardockyo Avatar asked Oct 29 '12 01:10

bardockyo


Video Answer


2 Answers

I had the same problem. Pymongo conflicts with the bson package. This worked for me:

sudo pip uninstall pymongo
sudo pip uninstall bson
sudo apt-get remove python-bson
sudo apt-get remove python-gridfs    # not sure if it's necessary
sudo pip install pymongo -U
like image 149
Jabba Avatar answered Nov 10 '22 20:11

Jabba


I was having the same issue and I installed it manually like this:

$ wget http://pypi.python.org/packages/source/p/pymongo/pymongo-2.3.tar.gz
$ tar xzf pymongo-2.3.tar.gz
$ cd pymongo-2.3
$ python setup.py install

Works for me. Good luck.

like image 39
elecay Avatar answered Nov 10 '22 21:11

elecay