LDAP3 Socket connection only works inside conda environment

  conda, ldap3, python-3.x, ssl

I try to connect to an LDAP Server using JupyterHub and LDAP Authenticator. The LDAP Authenticator python module uses the LDAP3 module to establish the connection (no ssl).

When I install the modules in a conda environment, the connection to the LDAP works. When just use pip outside the conda environment, I get this error:

File "/usr/local/lib/python3.8/dist-packages/ldap3/core/tls.py", line
280, in start_tls
return self._start_tls(connection)
File "/usr/local/lib/python3.8/dist-packages/ldap3/core/tls.py", line 289, in _start_tls
raise start_tls_exception_factory(e)(connection.last_error)
ldap3.core.exceptions.LDAPStartTLSError: wrap socket error: [Errno 104] Connection reset by peer

It even works, when I install the modules with pip instead of conda inside the conda env.

I use a regular ubuntu container with python 3.9.5 The python and pip versions and the versions of all dependencies are equal inside and outside the environment. I can’t find any difference.

Source: Python-3x Questions

LEAVE A COMMENT