Reputation: 1852
I'm trying to use visual studio code to write some python as I can't handle the memory requirements of pycharm. I'm also working around a corporate proxy, so I've installed cntlm locally to get around this so all requests need to go to 127.0.0.1
I started visual studio code using;
<yada yada>\Microsoft VS Code\Code.exe" --proxy-server=http=127.0.0.1:3128
so far so good. It they suggests that I'm lacking the pylint module and fails to install it because it's using the wrong proxy;
(venv) <yada yada>PycharmProjects/Rosaline/venv/Scripts/python.exe -m pip --proxy <corporateproxy>:80 install -U pylint
So my first question is why doesn't vsc tell pip to use the right proxy and the second question is why is it installing a linter on a per project basis?
Upvotes: 3
Views: 8207
Reputation: 16040
It doesn't use the proxy settings because honestly no one has ever made the feature request to pass them on down to pip. Please open a feature request at https://github.com/microsoft/vscode-python.
Upvotes: 1
Reputation: 9033
Don't try to solve that in VS Code, but on OS level. You can create a global config file for PIP, where you set the proxy for it to use. By that it doesn't matter if you use VS Code or a terminal to run PIP. In a terminal, run:
python -m pip config --global set global.proxy https://your-proxy:PORT/
For details of pip config, see: https://pip.pypa.io/en/stable/reference/pip_config/
Nevertheless, you still need to set proxy correctly in VS Code so that you e.g. can download plugins. VS Code makes use of environment variables http_proxy
and https_proxy
. If you set those correctly, no further configuration is required. Otherwise, you can also explicitly set those settings within VS Code configuration. Just search for proxy in the settings dialog.
Upvotes: 11