Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use CNTLM to connect to pip

Tags:

python

proxy

I'm trying to use Pip behind a proxy server which requires authentication. I've installed cntlm and filled out the hashed passwords. When I run this:

    cntlm -c cntlm.ini -I -M http://www.google.co.uk

I enter my password and then get this as a result:

   Config profile  1/4... Auth not required (HTTP code: 200)
   Config profile  2/4... Auth not required (HTTP code: 200)
   Config profile  3/4... Auth not required (HTTP code: 200)
   Config profile  4/4... Auth not required (HTTP code: 200)

   Your proxy is open, you don't need another proxy. 

However, pip doesn't work, still giving me a timeout. Knowing that I don't need another proxy is all fine and dandy, but pip still times out. Port 3128 is working because I can telnet on that port and it shows as listening under netstat. So what should I do from here?

Thank you.

like image 439
Tensigh Avatar asked Sep 24 '13 07:09

Tensigh


1 Answers

I have had the exact same issue.

Cntlm is used for authentication proxy servers, these statements mean that your server does not require authentication.

The pip command does have a --proxy option. Try using something like:

pip install --proxy=10.0.0.1:80 package_name

If this works, you know that you don't need authentication to access the web. If it still fails try:

pip install --proxy=user:[email protected]:80 package_name

This works to get around authentication. I have written a small cmd script to get around this in windows:

@echo off
:: GetPwd.cmd - Get password with no echo.
setlocal
<nul: set /p passwd=
for /f "delims=" %%i in ('python -c "from getpass import getpass; pwd = getpass();print     pwd;"') do set passwd=%%i
echo.

::Prompt for the package name
set /p package=What package would you like to get:

::Get the package with PIP
pip install --proxy="admin:%passwd%@PROXY_ADDRESS:80" %package%
endlocal
like image 138
David Folkner Avatar answered Oct 10 '22 14:10

David Folkner