I’m using bench 4.1.0 and I wanted to connect ERPNext through the Yunohost.
I followed the instruction given here for LDAP setup - How to configure yunohost.org LDAP server for Frappe / ERPNext
When it gave me the error, I logged in as a default frappe user (I gave another name while installing) and update the bench with bench update and ensured that I’m on master chain by adding “bench switch-to-master”.
It was still giving errors so I followed Saurabh’s suggestion as ran - ./env/bin/pip install python-ldap from the frappe-bench.
And that it started to work.