Wednesday 17 October 2012

Raspberry Pi - Python - Installing modules

Anyway, I've been using python on my raspberry pi to create some small programs and I've got a little more advanced I wanted to use some open source modules written by others.  Most python modules will come with a setup program,, which when called should install the module in the right place and configure the environment.

However whenever I tried to do this, I was presented with the following error:

"No module named setuptools"

Some google searches and a read of the website told be I was missing the python setup tools component distribute.

So the first step is to install distribute:

mkdir python-setuptools
cd python-setuptools
wget -O - | sudo python

Then download whatever module you need and run the program using the command:

sudo python install

Then with a bit of luck, your module should be setup and ready to use.


  1. Thanks for this post! I'm getting a similar error. I need to install the twitter api, so I assume I write "sudo python twitter"?? However I get told that python cannot open setup.p. There is not in my directory so do I need to change to a different directory?


    1. Ok, im not really sure from your description what your problem is. What module are you trying to install? Have you followed the blog post and installed distribute? Any other info ?

  2. Hi Martin,

    Im trying to install distribute but after downloading and I try to do "sudo python" it says: cant open file... such file or directory. Anything you know how to get around?



    1. Did you download the file using - "curl -O" - did it work? Or create an error?

  3. Hi,

    I did ""curl -O" and got in return:

    """Bootstrap distribute installation

    If you want to use setuptools in your package's, just include this
    file in the same directory with it, and add this to the top of your

    from distribute_setup import use_setuptools

    If you want to require a specific version of setuptools, set a download
    mirror, or use an alternate download directory, you can do so by supplying
    the appropriate options to ``use_setuptools()``.

    This file can also be run as a script to install or upgrade setuptools.
    import os
    import shutil
    import sys
    import time
    import fnmatch
    import tempfile
    import tarfile
    import optparse

    from distutils import log...."

    It continues with alot more commands and text. No warnings that I can see. According to the file "curl -O" refers to has been changed in July 2013, could it be the method has changed since your guide was written?

    If i try to list the files in directory python-distribute after "downloading" no files are shown.

    Big big thanks Martin for replying to my call for help! Very green in the software programing world.


  4. Hi again Martin,

    solved the problem with the info from and just run "sudo apt-get install python-setuptools"

    Thanks again for your help!


Note: only a member of this blog may post a comment.