New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionRefused on first attempt at exporting image #164

dwjp opened this Issue Dec 4, 2018 · 2 comments


None yet
3 participants
Copy link

dwjp commented Dec 4, 2018

I'm running orca in a miniconda container, which is in turn running as a celery service (though probably not relevant).

On the first one or two attempts at generating an image (when kicking off at about the same time, but on separate processes), I get connection refused. On subsequent tries, it works fine, everytime.

At a guess, I suspect the python client isn't waiting long enough for orca to start, but makes it through on a warm restart when orca starts a bit quicker?

File "/opt/conda/lib/python2.7/site-packages/plotly/io/", line 1298, in to_image
File "/opt/conda/lib/python2.7/site-packages/", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "/opt/conda/lib/python2.7/site-packages/", line 212, in call
raise attempt.get()
File "/opt/conda/lib/python2.7/site-packages/", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "/opt/conda/lib/python2.7/site-packages/", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/opt/conda/lib/python2.7/site-packages/plotly/io/", line 1205, in request_image_with_retrying
response = + '/', data=json_str)
File "/opt/conda/lib/python2.7/site-packages/requests/", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/opt/conda/lib/python2.7/site-packages/requests/", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/conda/lib/python2.7/site-packages/requests/", line 518, in request
resp = self.send(prep, **send_kwargs)
File "/opt/conda/lib/python2.7/site-packages/requests/", line 639, in send
r = adapter.send(request, **kwargs)
File "/opt/conda/lib/python2.7/site-packages/requests/", line 502, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='localhost', port=45166): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f7ba9543550>: Failed to establish a new connection: [Errno 111] Connection refused',))


This comment has been minimized.

Copy link

ociule commented Dec 4, 2018

I've seen this behaviour enough times for it to become very annoying, I would appreciate a robust retry policy. Thanks.

PS: running orca on Windows 7, through Git bash or cmd.


This comment has been minimized.

Copy link

jonmmease commented Dec 5, 2018

Hi @dwjp and @ociule,

Thanks for letting us know. What's happening here is that launches orca as a server process the first time you export an image. It does have a robust retry policy for communicating with the server, it just currently gives up after 8 seconds 🙂

This number is admittedly a bit arbitrary, and it sounds like we should increase it. I've opened a issue for this at plotly/

In the meantime, here's a workaround. You can ask to start the orca process manually (before you call write_image) by calling So you can add something like this to the top of your script/notebook

import plotly
import time

This will give the server an extra 10 seconds to startup (in addition to the 8 seconds that write_image will retry for).

I'm going to close this issue in favor of plotly/ since this is a, not orca, issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment