Installing openstack python clients on mac yosemite

Up to mavericks I had all my openstack python clients installed and working on my mac. However, after the upgrade to yosemite I started to get some errors about some missing libraries. After spending more time than I would have liked I managed to get the python openstack clients working again.

Remove older versions of python

  • rm -rf /Library/Frameworks/Python.framework/Versions/2.7
  • rm -rf “/Applications/Python 2.7”
  • rm /usr/bin/python
  • brew rm python

Update python version

The latest available version up to this time of writing was 3.4

After the installation is completed make sure to update the Current symlink

  • ln -s /Library/Frameworks/Python.framework/Versions/3.4 /Library/Frameworks/Python.framework//Versions/Current

and the python symlink:

  • ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /usr/bin/python

Also needs to update symlinks for pip and easy_install

  • ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/pip3.4 /usr/bin/pip
  • ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/pip3.4 /usr/local/bin/pip
  • ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/easy_install-3.4 /usr/bin/easy_install
  • ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/easy_install-3.4 /usr/local/bin/easy_install

Install libffi

Libffi is a dependency for the python-glanceclient. If the lib is not present you might get an error like this: > /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/usr/include/ffi -I/usr/include/libffi -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c c/_cffi_backend.c -o build/temp.macosx-10.6-intel-3.4/c/_cffi_backend.o

c/_cffi_backend.c:13:10: fatal error: ‘ffi.h’ file not found

include <ffi.h>

1 error generated.

Note: will not use ‘__thread’ in the C code

The above error message can be safely ignored

error: command ‘/usr/bin/clang’ failed with exit status 1

To install the libffi I used brew:

  • brew install libffi

Install pbr

PBR is also another dependency for the python-glanceclient, without PBR you might get an erro message like the following: >$ glance –help Traceback (most recent call last): File “/Library/Frameworks/Python.framework/Versions/3.4/bin/glance”, line 6, in <module> from import main File “/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/glanceclient/”, line 24, in import pbr.version ImportError: No module named ‘pbr’

To install PBR:

  • pip install pbr

Finally, install the clients

Don’t forget to export the PKG_CONFIG_PATH which will include the dir of the libffi installed with bew: - export PKG_CONFIG_PATH when running the install command sudo PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/ python install