1

I can't install python-ldap using virtualenv and pip. When I run command:

pip install python-ldap:

Cleaning up...
Command /opt/odoo/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-1xwfhM-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pjbP3I-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/odoo/venv/include/site/python2.7 failed with error code 1 in /tmp/pip-1xwfhM-build
Traceback (most recent call last):
  File "/opt/odoo/venv/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/opt/odoo/venv/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/opt/odoo/venv/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 41: ordinal not in range(128)

I tried downloading latest version from here: https://pypi.python.org/pypi/python-ldap#downloads, but it seems thats the same version as it gives same error. Am I missing something here or this version is bugged?

Update I think I should have included this message of error too. This goes before that one:

error: command 'gcc' failed with exit status 1

Andrius
  • 19,658
  • 37
  • 143
  • 243

2 Answers2

2

In RHEL/Centos, I needed to install openldap-devel.

Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
1

It seems I was missing some packages. This solved the problem:

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

Found it here: How do I install python-ldap in a virtualenv on Ubuntu?.

This install needs to be done outside the virtual environment and not within the virtual environment.

Community
  • 1
  • 1
Andrius
  • 19,658
  • 37
  • 143
  • 243