Orca not accepting HTTP_PROXY environment variable

I am plotting and HTML and SVG, on a non-proxy network my code works file. When I’m on a network with a proxy the HTML plot works, and SVG hangs indefinitely. When I walk the code I see the SVG is using orca. Therefore I’m focusing my debugging effort on answering the question: Why doesn’t Orca accept my proxy?

I run in a docker image, under which orca works. I have set the environment variables HTTP_PROXY and HTTPS_PROXY in the docker container and confirmed that I can see them in my Python code using os.environ['HTTP_PROXY'] and also confirmed I see them on the shell of the running container using docker exec -it bfc98c6c69d2 bash and echo $HTTP_PROXY.

I’ve tried setting both upper and lower case versions HTTP[S]_PROXY and http[s]_proxy with no success.

The plotly docs explicitly state that this is the correct configuration, I’ve followed their URL format to a tee: Requests Behind Corporate Proxies | Python | Plotly

When following the code in the debugger it hangs on _orca.py:1565 which is calling function request_image_with_retrying(...). That function goes into a retry loop (tenacity package). That function is failing on _orca.py:1475 when trying to connect to http://localhost:43225, which is the orca service if I understand correctly.

The command at 1475 is throwing an uncaught exception:

{ProxyError}HTTPConnectionPool(host='192.168.49.1', port=8000): Max retries exceeded with url: http://localhost:43225/ (Caused by ProxyError('Cannot connect to proxy.', ConnectionResetError(104, 'Connection reset by peer')))

Perhaps what is happening here is that the plotly <=> orca connection is improperly trying to use the proxy for the local inter-process communication?

Solution:

Set an environment variable:

NO_PROXY=localhost

Explanation:

Plotly is using python requests module to communicate between processes on localhost. The requests module is correctly obeying the HTTP[S]_PROXY environment variables, including NO_PROXY.

Recommended followups for Plotly devs: