[Solved] LDAP Update issue on development environment


Just a heads up. I hit this issue twice on separate instances of frappe/erpnext dev virtualbox

During update process, update was halted with a compilation error for the python-ldap module:

Command "/home/frappe/frappe-bench/env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-iP8He3/python-ldap/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-iEKLhr-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python2.7/python-ldap" failed with error code 1 in /tmp/pip-build-iP8He3/python-ldap/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 79, in _update
  File "/home/frappe/bench-repo/bench/utils.py", line 375, in update_requirements
    install_requirements(pip, req_file)
  File "/home/frappe/bench-repo/bench/utils.py", line 379, in install_requirements
    exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
  File "/home/frappe/bench-repo/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/frappe/requirements.txt

Just documenting this here in case any one else has this issue.

If you are on ubuntu(as the virtualbox images are) the following will fix the issue:

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

This is due to missing headers for the ldap library

1 Like

@saurabh6790 please help.


had the same problem. Your remedy solved the problem.

Thank you.

To the ErpNEXT-Pros :slight_smile:

In general terms,

i have observed sometimes such problems with required elements to be installed for a proper upgrade using bench.

It seems to be a common problem.
So it would be a good idea to find a mechanism, which installs such requirements during the upgrade process. This may be needed to be defined by the developers, because some requirements can not been resolved automatically.


You will need to install following packages depending upon your OS

For Ubuntu or Debian based system:
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

For CentOS or RHEL based system:
sudo yum install python-devel, openldap-devel

After this run bench update. Hope this solves your problem :smiley:

@shreyasp Yup I’ve already solve it just documenting here in case people search the forum for the issue.