Installing python-ldap in virtualenv fails

Bug #843080 reported by klmitch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
High
Unassigned

Bug Description

Trying to install python-ldap fails when installing it in virtualenv via pip-requires file:

  Running setup.py install for python-ldap
    extra_compile_args:
    extra_objects:
    include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
    library_dirs: /usr/local/openldap-2.3/lib
    libs: ldap_r lber sasl2 ssl crypto
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found

    file Lib/ldap.py (for module ldap) not found
    file Lib/ldap/schema.py (for module ldap.schema) not found
    warning: no files found matching 'Makefile'
    warning: no files found matching 'Modules/LICENSE'
    building '_ldap' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.13 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
    Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/jpipes/repos/keystone/.keystone-venv/bin/python -c "import setuptools;__file__='/home/jpipes/repos/keystone/.keystone-venv/build/python-ldap/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-fKiqUz-record/install-record.txt --install-headers /home/jpipes/repos/keystone/.keystone-venv/include/site/python2.7:
    extra_compile_args:

extra_objects:

include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl

library_dirs: /usr/local/openldap-2.3/lib

libs: ldap_r lber sasl2 ssl crypto

running install

running build

running build_py

file Lib/ldap.py (for module ldap) not found

file Lib/ldap/schema.py (for module ldap.schema) not found

creating build

creating build/lib.linux-x86_64-2.7

copying Lib/ldapurl.py -> build/lib.linux-x86_64-2.7

copying Lib/ldif.py -> build/lib.linux-x86_64-2.7

copying Lib/dsml.py -> build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/async.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/controls.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/dn.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/filter.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/functions.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/resiter.py -> build/lib.linux-x86_64-2.7/ldap

copying Lib/ldap/sasl.py -> build/lib.linux-x86_64-2.7/ldap

creating build/lib.linux-x86_64-2.7/ldap/schema

copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-2.7/ldap/schema

copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-2.7/ldap/schema

copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-2.7/ldap/schema

copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-2.7/ldap/schema

file Lib/ldap.py (for module ldap) not found

file Lib/ldap/schema.py (for module ldap.schema) not found

running egg_info

writing requirements to Lib/python_ldap.egg-info/requires.txt

writing Lib/python_ldap.egg-info/PKG-INFO

writing top-level names to Lib/python_ldap.egg-info/top_level.txt

writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

file Lib/ldap.py (for module ldap) not found

file Lib/ldap/schema.py (for module ldap.schema) not found

reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

warning: no files found matching 'Makefile'

warning: no files found matching 'Modules/LICENSE'

writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'

running build_ext

building '_ldap' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/Modules

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.13 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o

Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

Is there some missing dependency that the python-ldap package relies on but needs to be installed on my machine?

-jay

Revision history for this message
klmitch (q-noreply) wrote :

pip likely can't do anything about this since it depends on a C library to be installed, which is out-of-scope for pip.

Depending on your operating system, you'll need to install the cyrus-sasl development package.

That would be cyrus-sasl-devel on RedHat based distros and libsasl2-dev on Debian based distros IIRC.

Revision history for this message
klmitch (q-noreply) wrote :

I think you're missing the sasl headers. On fedora they are in the cyrus-sasl-devel rpm should be named something similar in the ubuntus.

Revision history for this message
klmitch (q-noreply) wrote :

As noted above, I solved this issue on Ubuntu by using apt to install dependencies of python-ldap:

Cyrus SASL - http://packages.ubuntu.com/natty/libsasl2-2 (also see libsasl2-dev)

On OS X, I solved a similar issue by specifying the last major version of openldap in pip-requires. That version restriction should probably be removed now, since it's clear this is an environment issue, not an issue with the latest pypi release.

Revision history for this message
klmitch (q-noreply) wrote :

Thanks all for the input. I'll grab libsas2-dev. Thanks.

Perhaps when all the Gerrit stuff is done, we can work on some packaging for Keystone that does not require the user to install stuff like this in the use cases where it's not relevant.

I want to do this for Glance, too. For instance, client-only packages, Swift+Glance packaging, etc..

Anyway, thx :)

-jay

Revision history for this message
klmitch (q-noreply) wrote :
Download full text (5.3 KiB)

OpenLDAP. Maybe we should remove this from pip-requires and have a
separate set of instructions for LDAP?

On 8/1/11 5:37 PM, "jaypipes"
<email address hidden>
 wrote:

>Trying to install python-ldap fails when installing it in virtualenv via
>pip-requires file:
>
> Running setup.py install for python-ldap
> extra_compile_args:
> extra_objects:
> include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
> library_dirs: /usr/local/openldap-2.3/lib
> libs: ldap_r lber sasl2 ssl crypto
> file Lib/ldap.py (for module ldap) not found
> file Lib/ldap/schema.py (for module ldap.schema) not found
> file Lib/ldap.py (for module ldap) not found
> file Lib/ldap/schema.py (for module ldap.schema) not found
>
> file Lib/ldap.py (for module ldap) not found
> file Lib/ldap/schema.py (for module ldap.schema) not found
> warning: no files found matching 'Makefile'
> warning: no files found matching 'Modules/LICENSE'
> building '_ldap' extension
> gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
>-Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS
>-DLDAPMODULE_VERSION=2.3.13 -IModules -I/usr/local/openldap-2.3/include
>-I/usr/include/sasl -I/usr/include/python2.7 -c Modules/LDAPObject.c -o
>build/temp.linux-x86_64-2.7/Modules/LDAPObject.o
> Modules/LDAPObject.c:18:18: fatal error: sasl.h: No such file or
>directory
> compilation terminated.
> error: command 'gcc' failed with exit status 1
> Complete output from command
>/home/jpipes/repos/keystone/.keystone-venv/bin/python -c "import
>setuptools;__file__='/home/jpipes/repos/keystone/.keystone-venv/build/pyth
>on-ldap/setup.py';exec(compile(open(__file__).read().replace('\r\n',
>'\n'), __file__, 'exec'))" install --single-version-externally-managed
>--record /tmp/pip-fKiqUz-record/install-record.txt --install-headers
>/home/jpipes/repos/keystone/.keystone-venv/include/site/python2.7:
> extra_compile_args:
>
>extra_objects:
>
>include_dirs: /usr/local/openldap-2.3/include /usr/include/sasl
>
>library_dirs: /usr/local/openldap-2.3/lib
>
>libs: ldap_r lber sasl2 ssl crypto
>
>running install
>
>running build
>
>running build_py
>
>file Lib/ldap.py (for module ldap) not found
>
>file Lib/ldap/schema.py (for module ldap.schema) not found
>
>creating build
>
>creating build/lib.linux-x86_64-2.7
>
>copying Lib/ldapurl.py -> build/lib.linux-x86_64-2.7
>
>copying Lib/ldif.py -> build/lib.linux-x86_64-2.7
>
>copying Lib/dsml.py -> build/lib.linux-x86_64-2.7
>
>creating build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/async.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/controls.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/dn.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/filter.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/functions.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-2.7/ldap
>
>copying Lib/ldap/resiter.py -> bui...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.