Friday, September 25, 2015

Install python-ldap on Ubuntu server

Doing the usual to install python-ldap on ubuntu server

$ pip install python-ldap

Gave me this unpleasant

$ error: command 'gcc' failed with exit status 1
After some searching around it turns out that it needs the development files for python and openldap. Installing it still gave me missing module error, which was a missing cyrus sasl package.

Solution

Install all three of these packages before you install python-ldap

$ sudo apt-get install python-dev
$ sudo apt-get install libldap2-dev
$ sudo apt-get install libsasl2-dev
Once all that out of the way run
$ pip install python-ldap
Now you should have a working python-ldap install.