Install and update Python packages behind a proxy
Pip, a package manager for Python, requires internet access when installing and updating packages from PyPI. If the Swimlane server is behind an outbound HTTP proxy server, then pip can be configured to connect through the proxy server in various ways.
- Using the --proxy command-line option to specify a proxy in the form [user:password@]proxy.url:proxy_port. The use of "user:password@" is optionally if the proxy requires authentication.
- By setting the standard environment-variables http_proxy, https_proxy, and no_proxy
- Using proxy in a Config file
Using Command-line
For a single package install or update you can use the pip built-in proxy flag.
Install
pip install --proxy=http://[user:password@]proxy_url:proxy_port <package_name>
Upgrade
pip install -U --proxy=http://[user:password@]proxy_url:proxy_port <package_name>
Using Environment Variables
For multiple package installs and updates, you can set environment variables and use the pip command as you normally would.
Using Config
Pip allows you to set all command-line option defaults in a standard ini style config file, pip.ini.
- To locate the pip.ini, follow the Config file link.
- Edit pip.ini file and add [global] proxy = http://[user:password@]proxy_url:proxy_port
Within Swimlane
From Swimlane Admin Console, go to "Config" tab. In the "Config" tab, you will find the option "Upload Pip Config for API and Tasks":
Check the "Upload Pip Config for API and Tasks" option, and upload a pip.conf file with the following content:
When using a proxy, the following sample code can be used for accessing the internet within the Swimlane Python Script task
Note: If you run into SOCKS error then use all_proxy=http://username:password@proxy_url:proxy_port