Filed under Raspberry Pi

Spotify on the Raspberry Pi

EDIT 30/12/2013:

Hi Guys/Gals, it’s been awhile since I originally posted this quick guide and it looks like people have been running into problems getting this working. I suspect that there has been some changes to the Spotify API that’s meant Hexxeh’s original Python scripts no longer work properly. If you’re still looking to get Spotify running on the Raspberry Pi can I suggest you take a look at the Pi Music Box¬†(it an SD Card image that allows Spotify and Google Play access). If your determined to get the original code working it might be best to file an issue on against Hexxeh’s Spotify WebSocket API here¬†

So I heard that it’s possible to run a Spotify client on the Raspberry Pi. So I had a google, and had a good go at getting it running…


If you google Spotify for Raspberry Pi, you’ll probably come across Despotify. This was a project to create a command line Linux Spotify client, it was popular and had matured over time. However due to some changes in the Spotify API and the Protocol it no longer works and it looks like no-one has decided to fix it… which is a shame.


Bring on Respotify! Respotify is essentially a remake of Despotify, it’s Python based and hooks into the Music Player Daemon. The Respotify package is made by Hexxeh a guy who’s made a few awesome tools over the years most notably he’s maintained some experimental releases of the development version of Chrome OS.

So to get going you’ll want to:

  1. Install Git so you can pull down the source from github.
    sudo apt-get update && sudo apt-get install git git-core
  2. Clone the Git Repo:
    git clone
  3. Install Music Player Daemon (MPD)
    sudo apt-get update && sudo apt-get install mpd ncmpc mpc
  4. Install Python and all it’s Dev Packages:
    sudo apt-get update && sudo apt-get install python python-dev
  5. Install Python PIP:
    sudo apt-get install python-pip
    cd spotify-websocket-api && sudo ./
    sudo easy_install
  6. Installing Dependacies:
    • I had problems with lxml so I used apt-get:
      sudo apt-get install python-lxml
    • The rest of the dependencies can be installed using the script in the git repo:
      cd spotify-websocket-api && sudo ./
  7. This can’t hurt but installing some of the libraries required by Despotify:
    sudo apt-get update && sudo apt-get install libao-dev libtool libssl-dev libmpg123-dev libvorbis-dev libncursesw5-dev
  8. And finally…:
    cd spotify-websocket-api/clients/respotify && python <SPOTIFY_USERNAME> <SPOTIFY_PASSWORD>

Hopefully this’ll help someone install Respotify as there doesn’t seem to be much documentation out there for getting this running on a Raspberry Pi.

ED: Added missing step to get easy_install working. Please leave a comment if you uncover other issues with getting everything running.


Howto get going with your Pi… the OS [part 2]

It’s been a while since my last Raspberry Pi orientated post, but tonight I’ve decided to swap out Ted’s SD Card and try and create a Despotify client.


Well the Raspberry Pi is different from other computers besides the obvious lack of case, and the small form-factor. It’s processor isn’t your typical Intel chip you find in your shiney desktop or fancy pants laptop. It’s an ARM processor. What does that mean? Well the processor in the Raspberry Pi is part of a family of processor chips that you tend to find in small devices, like your tablet or smart phone. These types of processors are quite specialist, they’re designed in a way that they don’t need your typical cooling such as heat-sinks and fans, they’re designed to be low power with low heat dissipation. With that your normal desktop operating system such as Windows or Apple Mac won’t run on this type of processor. However you can run Linux on it, if you don’t know what Linux is, perhaps you’ve heard of or used Ubuntu? Without going into the details of what Linux is (and its politics and ethos), all we need to know is its free and easily available and is able to run on literally anything with a few megahertz.


In the beginning during the early Raspberry Pi development, the Linux flavour known as Fedora seemed to be the popular choice however now it seems the flavour known as Debian is taking over. I’m going to give a quick break down on how to get going on this Debian flavour, which has been bundled and repackaged and re-branded for the Raspberry Pi and is now known by the name of Raspbian (clever name eh?).


The main aim of this whole process is writing the operating system image to the SD Card, for this we need to use a tool called Win32Diskimager (assuming your on Windows!). What Win32Diskimager does is, write every byte of the image to the SD Card at a low-level that the Raspberry Pi can boot from.

You’ll need to go grab the image tool from Sourceforge, and then extract it (Desktop will be fine).

Next we’ll want to go grab the actual operating system image itself! Luckily the Raspberry Pi foundation provide all of this for us! Just head over to downloads page. At the time of writing you’ll want the image.


Next we’ll want to pop the SD Card into the SD Card Reader slot on your PC/Laptop, and open up Win32DiskImager – and run Win32DiskImager.exe.

Once your image has also downloaded you’ll want to extract that too. Inside the zip file should be a .img file, this is your image file we’re going to write to your SD Card. You’ll then need to open your .img file from within Win32DiskImager, and select the drive letter for your SD Card. Then hit go, it should take a few minutes, remember SD Card tend to read/write at about 4-10mb/s and the .img file is close to a couple gigabytes.

Once it’s written to the SD Card, you can pop it into your Raspberry Pi. By default the new Raspberry Pi image boots up to a Desktop, this means you’ll want to plug in a mouse, keyboard and a network cable as well as your HDMI or RCA leads to your TV.

First Boot

So you may have noticed that the Raspberry Pi boots upon being plugged into the mains. You’ll also notice on your TV that there’s lots of scrolling text, don’t worry about this now! You’ll have plenty of time to find out what all this means ;-)

On first boot Raspbian loads up the raspi-config screen. This is your initial setup screen, here we can make some adjustments to your installation.

  1. One of the first things you’ll want to do is extend the partition size so it fills your entire SD Card. When we wrote the .img file to the SD Card, we wrote the exact bytes of the image file to the SD Card, so at this point in time your SD Card has some unused space. To do this option select expand_rootfs
  2. Next thing to do it ensure your regional settings are correct, so you’ll want to do change_locale to change your language settings so your Raspberry Pi knows your not writing in Chinese! Next you’ll want to change change_timezone, which sets the date-time.
  3. If your TV’s picture is a bit fuzzy or hazy you can change it using the overscan option.
  4. Depending on what you want to use your Pi for, I highly recommend considering overclocking, and reducing the graphics memory.
    • Overclocking the Pi is safe, but I wouldn’t get too adventurous as it’ll kill your Pi over time. Select the overclock option, I would recommend no more than the 800Mhz option.
    • Reducing the graphics memory, means you get more system memory – which depending on what your doing might be a good or a bad thing. Playing games and videos will require more memory, so you may want to opt it higher to say 64Mb, or if you intend to run your Pi ‘headless’ you can reduce it right down to 16Mb. You can find this option in memory_split
  5. Finally you may want to consider how you wish to access your Pi.
    • I opt’d for ‘headless’ meaning I can only SSH in or go in via a command prompt, so I turned off the desktop so it doesn’t load on boot. This saves me some more memory and processing power. You can turn SSH on at boot via the ssh option.
    • If you want the desktop on when you boot you can enable it, or disable it if you don’t want it via boot_behaviour

Once you’re happy with your settings and options, you can press down or tab and it’ll take you to the Finish link. This will ask you to reboot your Pi for the settings to take effect, I highly recommend at this early stage you reboot. Once rebooted you’re ready to go with your Pi.