Monday, February 18, 2013

Setting up on OS X

I wanted to get the environment set up and running on OS X.  According to their wiki, that's one area where they could use help.  So, getting the client app running seemed like a good place to start.

First I installed Mercurial from the installer on the home page, which is what they use for source control.  I then pulled down all of the source code repositories found on Bitbucket here, with "hg clone".

In the crazyflie-pc-client repository, cd'ing to cfclient and attempting  python ./ resulted in:

No pyusb installation found, exiting!

Installing pyusb on OS X is easy:

sudo easy_install pyusb

Attempting to run it again results in another missing dependency error for pygame; first I attempted to resolve that with:

sudo easy_install pygame

However, that resulted in a bunch of errors, and I would up instead installing the binary package for Lion, available on the pygame website, which seemed to install OK.

The next dependency issue I hit was with PyQT4.  I attempted to install the binaries for that as well, found on the PyQtX project.

Unfortunately, attempting to install that resulted in an error:  "Python 2.7 from official python website is not installed.".

The version of Python on my machine (OS X Lion, Version 10.7.5) is:

python -V
Python 2.7.1

So I'm not sure why PyQT4 was complaining, but I went ahead and installed the latest stable 2.7.x Python release (Python 2.7.3 Mac OS X 64-bit/32-bit x86-64/i386 Installer):

Which appeared to install "python2.7-32", the only 2.7.3 version of Python I could find in my path.

Next, the PyQT4 install finally was able to be started, but it indicated that it requires the Qt Libraries to be installed - specifically, 4.8.2.  I found some versions on the Qt Project home page, but the closest was 4.8.4.

I installed the 4.8.4 version of Qt, then continued with the PyQT4 install, and finally PyQT4 appeared to have installed successfully, with an ugly confirmation dialog:

Now back to cfclient.  Attempting to run again with 2.7.3 resulted in this:

$ python2.7-32  ./ 
Traceback (most recent call last):
  File "./", line 74, in <module>
    from ui.main import MainUI
  File "/Users/mikevoyt/Development/repositories/crazyflie/crazyflie-pc-client/cfclient/ui/", line 36, in <module>
    from PyQt4 import Qt, QtCore, QtGui, uic
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/PyQt4/, 2): no suitable image found.  Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/PyQt4/ mach-o, but wrong architecture

This had me stumped a bit; 'python -V' was still showing 2.7.1 while 'python2.7-32 -V' seemed to be the only version of Python I had installed showing 2.7.3.  Well it turns out the '-32' is the 32-bit version (duh), and the PyQt4 binary only supports the 64-bit version.  I found the 64-bit version along with the other versions here:


The version of 'python2.7' in my path was pointing to a binary in /System/Library/Frameworks, which explains why it was still back at 2.7.1 (so apparently all of the pre-installed Python versions are in /System, while the install put the new versions in /Library).

So after moving /usr/bin/python off to the side, and creating a simlink to the new version in /usr/bin:

sudo ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/python

finally, "pyton ./" finally brought up the UI!

So after a few hours of downloading libraries, Googling, poking around, and some luck, I was finally able to run the Python client app on OS X.  This is one of the reasons it'd be nice to create a native OS X app (with maybe a very lightweight Pyton library for communications) for controlling the device.  For now though this should be a good place to start figuring out how stuff works.


  1. This looks great! Thanks for taking the time to post your findings. I too am a mac user eagerly awaiting my Crazyflie :P I look forward to giving this shot.

    Btw, any idea why the codebase is in bitbucket/mercurial? Just seems like GitHub is the way to go these days... at least that's where all my stuff is. I just think their collaboration tools blow everything else out of the water.

    Anyway, I'm not an os x app dev by a long shot, but if you feel like working towards something, I'd be happy to contribute.

    1. Hi - thanks for commenting. I hear you - I personally prefer Git/GitHub to Mercurial/BitBucket. Someone asked a similar question on the Crazyflie forums, and the developers replied that they preferred Mercurial/BitBucket and didn't see much of a reason to change... and it's really their call :)
      Actually they work pretty much the same and I didn't have too much trouble cloning/committing & submitting a pull request...

  2. I finally got my crazyflie... all the assembly and soldering is done :) still battling through getting the ui running. One thing I have run into is there must be a breaking change in python 2.7.4 as I am getting an import error regarding MAXREPEAT. either way, I found a fix here:

  3. wheee.. got the UI running! I was able to establish a connection to the crazyflie, but the telemetry being displayed was lagged and didn't seem to match. Either way, it's progress. Going to pick up a cheap PS3 controller tomorrow and will hopefully be able to at least get basic flight :)

    1. Cool, how did it go? I'm having trouble getting the Crazyradio working on my MacBook...

  4. I got the UI working, but cannot see the crazy flie on the "scanning" view. just lists the debugger.

  5. PrimoVPN is the first low cost VPN client for Mac that is easy to use and reliably establishes a secure network connection.
    Helps you get out of the trouble all Mac VPN users ran into after upgrading to Mac OS Sierra version - it just runs PPTP protocol.
    Also support L2TP/IPSec protocol. More to come.

  6. With regard to busy families and companies, spring cleaning can in fact lead to lack of valuable period and revenue. That's why lots of people today simply contact companies focusing on cleaning providers - with regard to fast, quality as well as hassle-free cleaning in your own home and at work. cleaning services in jumeirah lake towers

  7. Pertaining to busy homeowners and corporations, spring cleaning can certainly lead to decrease of valuable occasion and earnings. That's why a lot of people today simply contact companies dedicated cleaning solutions - pertaining to fast, quality along with hassle-free cleaning in your house and on the job. cleaning services dubai marina