Pymongo: Python Driver for MongoDB

This post describes the installation and upgrade procedures on Ubuntu 10.04

Installation with pip

ubuntu@ubuntu:~$ sudo pip install pymongo
[sudo] password for ubuntu:
Downloading/unpacking pymongo
Downloading pymongo-2.2.1.tar.gz (230Kb): 230Kb downloaded
Running setup.py egg_info for package pymongo
Installing collected packages: pymongo
Running setup.py install for pymongo
building ‘bson._cbson’ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/_cbsonmodule.c -o build/temp.linux-i686-2.6/bson/_cbsonmodule.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/time64.c -o build/temp.linux-i686-2.6/bson/time64.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/buffer.c -o build/temp.linux-i686-2.6/bson/buffer.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/encoding_helpers.c -o build/temp.linux-i686-2.6/bson/encoding_helpers.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.6/bson/_cbsonmodule.o build/temp.linux-i686-2.6/bson/time64.o build/temp.linux-i686-2.6/bson/buffer.o build/temp.linux-i686-2.6/bson/encoding_helpers.o -o build/lib.linux-i686-2.6/bson/_cbson.so
building ‘pymongo._cmessage’ extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c pymongo/_cmessagemodule.c -o build/temp.linux-i686-2.6/pymongo/_cmessagemodule.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.6 -c bson/buffer.c -o build/temp.linux-i686-2.6/bson/buffer.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.6/pymongo/_cmessagemodule.o build/temp.linux-i686-2.6/bson/buffer.o -o build/lib.linux-i686-2.6/pymongo/_cmessage.so
Successfully installed pymongo

Importing pymongo

[sourcecode language=”python”]
ubuntu@ubuntu:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>>
[/sourcecode]

Upgrading pymongo to latest version

ubuntu@ubuntu:~$sudo pip install –upgrade pymongo

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.