Wednesday, October 29, 2014
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 does 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 foud 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
swift command should work without issue.