python-ldap / python-ldap

LDAP client API for Python
https://python-ldap.readthedocs.io/
Other
404 stars 120 forks source link

Installation/Build fails behind proxy server #474

Open mattkrins opened 2 years ago

mattkrins commented 2 years ago

Issue description: Installation/Build fails behind proxy server

$ sudo pip install --proxy=http://10.132.200.19:8080 python-ldap

Collecting python-ldap
  Using cached python-ldap-3.4.0.tar.gz (376 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8441c071f0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/setuptools/
      WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f8441c07ee0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/setuptools/
      WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f844283d7e0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/setuptools/
      WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f844283c6a0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/setuptools/
      WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x7f844283d2a0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /simple/setuptools/
      ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
      ERROR: No matching distribution found for setuptools>=40.8.0
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

From the output it seems setuptools may be failing to download a required submodule, however the error does not indicate which one.

Steps to reproduce: Attempt to install/build python-ldap using pip behind a proxy server. pip install --proxy=http://server:port python-ldap

Operating system: Linux/Ubuntu Python version: 3.10.4 python-ldap version: All versions

markandrewj commented 1 year ago

We have been experiencing the same issue with this package. I am not really sure why it seems to only be an issue for this specific package.

mattkrins commented 1 year ago

I am not really sure why it seems to only be an issue for this specific package. The hint comes from note: This error originates from a subprocess, and is likely not a problem with pip.

The python-ldap install script must grab additional files using a subprocess using its own getter which ignores the proxy params passed to pip.

I gave up on this library in our enterprise environment a long time ago and have since migrated to Node & ldapjs instead which works behind proxy servers.

markandrewj commented 1 year ago

This feedback is helpful, thank you for the information.

yakhatape commented 1 year ago

@markandrewj @mattkrins just facing same issue today you just need to export both env proxy variable : export https_proxy=http://XXXXXX:1234/ export http_proxy=http://XXXXXX:1234/

If you define only your http_proxy its not working looks like python-ldap lib check https_proxy one.