ThorneLabs

Installing python-swiftclient on OS X Yosemite

• Updated January 10, 2019


Installing python-swiftclient on OS X Yosemite is exceedingly difficult compared to earlier versions of OS X. Yosemite ships with Python 2.7.6. Running sudo easy_install pip will install pip 1.5.6.

Those versions should work with python-swiftclient, but after installing the package with pip install python-swiftclient and running the swift command, the following error is thrown:

Traceback (most recent call last):
  File "/usr/local/bin/swift", line 7, in <module>
    from swiftclient.shell import main
  File "/Library/Python/2.7/site-packages/swiftclient/shell.py", line 31, in <module>
    from swiftclient.multithreading import OutputManager
  File "/Library/Python/2.7/site-packages/swiftclient/multithreading.py", line 22, in <module>
    from six.moves.queue import PriorityQueue
ImportError: No module named queue

Google searching did not turn up anything useful. I would expect this error if Yosemite was using Python 3 because the queue module has been renamed. I can only assume the problem is due to Apple making their own modifications to the system installed Python, easy_install, and pip.

A colleague suggested installing Python, easy_install, and pip from Homebrew. This ended up being the solution.

Before installing Python, easy_install, and pip from Homebrew, clean up what was installed with the system installed pip by running the following commands (the Python dependencies for python-swiftclient can be found here):

sudo pip uninstall futures
sudo pip uninstall requests
sudo pip uninstall simplejson
sudo pip uninstall six
sudo pip uninstall python-swiftclient

Next, if you haven’t already, install Homebrew by following the instructions on their website.

Then, install Python (this will setup a new easy_install and pip for you):

brew install python

Finally, install python-swiftclient:

pip install python-swiftclient

Now the swift command should work without issue.

If you found this post useful and would like to help support this site - and get something for yourself - sign up for any of the services listed below through the provided affiliate links. I will receive a referral payment from any of the services you sign-up for.

Get faster shipping and more with Amazon Prime: About to order something from Amazon but want to get more value out of the money you would normally pay for shipping? Sign-up for a free 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.

Thanks for reading and take care.