0

Is there a way to get pip install to use libcurl instead of urllib3? I tried reading the help page of pip install and don’t find anything option to change to libcurl. The reason for asking is because urllib3 cannot handle NTLM authentication but libcurl does.

My PC is behind a company firewall that uses NTLM. Solutions online points to CNTLM and Fiddler which are also blocked by company policy. This has been raised in several many github projects without any resolution and so I had to resort to finding a solution myself.

Some github issues:

  1. https://github.com/pypa/pip/issues/1182

  2. https://github.com/pypa/pip/issues/3020

  3. https://github.com/pypa/pip/issues/4967

  4. https://github.com/urllib3/urllib3/issues/242

  5. https://github.com/urllib3/urllib3/issues/1434

  6. https://github.com/Azure/azure-cli/issues/8047

Some SO posts:

  1. How to use pip on windows behind an authenticating proxy

  2. Using pip behind a proxy with CNTLM

pip install somepackage --proxy https://:@proxyserver:proxyport does not work too.

Same issue with conda.

pynoob
  • 11
  • 2
  • How are dependencies managed in your project? https://packaging.python.org/tutorials/managing-dependencies/ or https://stackoverflow.com/questions/29751572/how-to-find-a-python-packages-dependencies – greenmarker Jun 15 '20 at 09:04
  • Since pip has no options for this, You can go to your python installation on your computer and edit the pip.py file to replace `urllib` with `libcurl`. – simic0de Jun 15 '20 at 09:27
  • @greenmarker thanks. the main issue is that `pip install` or `conda install` is unable to connect to the internet because of lack of the NTLM auth. – pynoob Jun 15 '20 at 09:59
  • How about wget or curl the `.whl` and pip it? – Natthaphon Hongcharoen Jun 15 '20 at 10:27
  • @NatthaphonHongcharoen, thanks. That is the current workaround. However, it is tedious to download the dependencies and there are so many combinations (https://www.lfd.uci.edu/~gohlke/pythonlibs/) it can confuse the more noobs like me – pynoob Jun 15 '20 at 10:32
  • Why not use CNTLM then? You've linked to 2 question discussing it. – phd Jun 15 '20 at 12:02
  • @pynoob I know the pain. My workaround is zip all the wheels in `.cache/pip/wheels` from my PC to gdrive (so I only need to `wget` once) and write `requirement.txt` (just `pip install -r requirement.txt` and be done with it) then hope there's no need to `apt install` anything 'cause that's blocked too. – Natthaphon Hongcharoen Jun 15 '20 at 12:59
  • @phd thanks. Sourceforge is also blocked. – pynoob Jun 15 '20 at 13:01
  • @NatthaphonHongcharoen thanks. Thumb drive is also disabled. The IT way is probably to whitelist pypi.org and files.pythonhosted.org. Or build an internal repo. But both ways are wrapped in red tape and will take ages. – pynoob Jun 15 '20 at 13:06
  • Naaa, google drive. https://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive – Natthaphon Hongcharoen Jun 15 '20 at 13:07
  • Then write all the wheel names in `requirement.txt` and `pip install -r requirement.txt` – Natthaphon Hongcharoen Jun 15 '20 at 13:07
  • 1
    All files sharing site are blocked to prevent data leakage. They even block github! – pynoob Jun 15 '20 at 13:08

0 Answers0