Configure socks proxy for Python pip

To setup a socks5 proxy for python pip, you need to install pysocks package, otherwise the following error will be occured:

% pip install --proxy socks5://192.168.1.8:1081  -r requirements.txt
ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support.

WARNING: There was an error checking the latest version of pip.

and run following command to install pysocks

% pip install pysocks
Collecting pysocks
Downloading PySocks-1.7.1-py3-none-any.whl (16 kB)
Installing collected packages: pysocks
Successfully installed pysocks-1.7.1

and then run pip with socks5 proxy settings:

% pip install --proxy socks5://192.168.1.8:1081  -r requirements.txt
Collecting requests==2.26.0 (from -r requirements.txt (line 1))
  Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting reppy==0.4.14 (from -r requirements.txt (line 2))
  Using cached reppy-0.4.14.tar.gz (93 kB)
  Preparing metadata (setup.py) ... done

Leave a Reply

Your email address will not be published. Required fields are marked *