LDAP error after moving to another server


I am getting following LDAP error after migrated to another ERPNext server. It can’t save LDAP configure.

Already installed ldap3 under frappe-bench location.

UnboundLocalError: local variable 'ldap3' referenced before assignment

Any suggestion would be appreciated.
Thank you.

I found the issue.
I was install wrong ldap library using system package. After removed all of them, and reinstall back the ldap3 using pip, it works.