Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install python-ldap on a Gentoo Server. It is running a Django application which I want to use LDAP Auth. Im using virtualenv to manage my python dependencies. I can't install python-ldap with pip in my virtualenv. It always fails to compile the C parts. I tried to emerge openldap but I alway get "sasl.h no such file or directory". Have anyone managed to get python-ldap working on Gentoo? Im using Python 2.7

Regards, Philip

share|improve this question
What USE-flags to you use to emerge net-nds/openldap? If you do not need the server, you maybe want to enable the minimal USE-flag. You could also install python-ldap via portage. This will install all deps for you. – Alexander Sulfrian Sep 28 '12 at 12:23
sudo emerge cyrus-sasl
sudo USE="minimal" emerge openldap

Now you can install python-ldap package from pip.

share|improve this answer

You need to install dev-libs/cyrus-sasl too as it provides the needed SASL headers. python-openldap compile fine on my machine. Just for information: my openldap USE flags are: "berkdb crypt ipv6 kerberos ssl syslog tcpd"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.