plotly cannot communicate with orca sometimes
See original GitHub issueI am running plotly on windows server 2016. When i try to plotly.io.write_image(), sometimes it works, but sometimes i got error like this:
For some reason plotly.py was unable to communicate with the
local orca server process, even though the server process seems to be running.
Please review the process and connection information below:
orca status
-----------
state: running
executable: C:\ProgramData\Anaconda3\orca.CMD
version: 1.1.1
port: 49345
pid: 11472
command: ['C:\\ProgramData\\Anaconda3\\orca.CMD', 'serve', '-p', '49345', '--plotly', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\plotly\\package
data\\plotly.min.js', '--graph-only', '--mathjax', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js']
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 83, in create_connection
raise err
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
chunked=chunked)
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 357, in make_request
conn.request(method, url, **httplib_request_kw)
File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\ProgramData\Anaconda3\lib\http\client.py", line 1026, in _send_output
self.send(msg)
File "C:\ProgramData\Anaconda3\lib\http\client.py", line 964, in send
self.connect()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 166, in connect
conn = self._new_conn()
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000241FDEF7978>: Failed to establish a new connection: [WinError 1
0061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\ProgramData\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=49345): Max retries exceeded with url: / (Caused by NewConnectionError('<urlli
b3.connection.HTTPConnection object at 0x00000241FDEF7978>: Failed to establish a new connection: [WinError 10061] No connection could be made because the
target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\plotly\io\_orca.py", line 1298, in to_image
height=height)
File "C:\ProgramData\Anaconda3\lib\site-packages\retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "C:\ProgramData\Anaconda3\lib\site-packages\retrying.py", line 212, in call
raise attempt.get()
File "C:\ProgramData\Anaconda3\lib\site-packages\retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "C:\ProgramData\Anaconda3\lib\site-packages\six.py", line 693, in reraise
raise value
File "C:\ProgramData\Anaconda3\lib\site-packages\retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "C:\ProgramData\Anaconda3\lib\site-packages\plotly\io\_orca.py", line 1205, in request_image_with_retrying
response = requests.post(server_url + '/', data=json_str)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\requests\adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=49345): Max retries exceeded with url: / (Caused by NewConnectionError('<ur
llib3.connection.HTTPConnection object at 0x00000241FDEF7978>: Failed to establish a new connection: [WinError 10061] No connection could be made because
the target machine actively refused it',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\reporter.py", line 72, in <module>
main()
File ".\reporter.py", line 63, in main
report = darwin.create_report(bat_config_file, date_, out_dir)
File "D:\Ken\tools\backtesting\python\bee\bat\darwin.py", line 300, in create_report
out_dir=out_dir)
File "D:\Ken\tools\backtesting\python\bee\bat\post_trade_report.py", line 117, in create_portfolio_report
plotly.io.write_image(fig, file=filename+".png", format="png", width=int(1920), height=int(1080))
File "C:\ProgramData\Anaconda3\lib\site-packages\plotly\io\_orca.py", line 1485, in write_image
validate=validate)
File "C:\ProgramData\Anaconda3\lib\site-packages\plotly\io\_orca.py", line 1315, in to_image
""".format(info=status_str))
ValueError:
For some reason plotly.py was unable to communicate with the
local orca server process, even though the server process seems to be running.
Please review the process and connection information below:
orca status
-----------
state: running
executable: C:\ProgramData\Anaconda3\orca.CMD
version: 1.1.1
port: 49345
pid: 11472
command: ['C:\\ProgramData\\Anaconda3\\orca.CMD', 'serve', '-p', '49345', '--plotly', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\plotly\\package
data\\plotly.min.js', '--graph-only', '--mathjax', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js']_
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Plotly in executable can't communicate with Orca server
Here's the twist: I created an executable of my file using pyinstaller , and it's only when I run the executable that I...
Read more >orca server communication problem with large dataset
I am using orca to export an image created with plotly. With small datasets there is no problem. But when I'm trying to...
Read more >Introducing Plotly Express - Medium
Plotly Express is a new high-level Python visualization library: it's a wrapper for ... using Orca, or edit them in a GUI with...
Read more >kaleido - PyPI
Use Kaleido to export plotly.py figures as static images ... Additionally, both 1 and 2 communicate between the Python process and the web...
Read more >Introduction to heatmaply
The rows and columns of the matrix are ordered to highlight patterns and are often accompanied by dendrograms. Heatmaps are used in many...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me, this boiled down to a permissions issue (orca 1.2.1 on ubuntu with plotly = 4.1.0). There were some folders in /tmp, name xvfb-run.<ID>, pulse-<ID>, v8-compile-cache-<ID>, that were from some older runs done under a different user. Removing these folders from /tmp directory allowed my new user to use orca once again.
I am experiencing the same issue with Plotly 3.6.0 in a Jupyter Notebook on Linux. ps reveals that the orca process is <defunct>. I suppose its parent process should be waiting on it, but it seems this is not the case. Its parent is:
python -m ipykernel_launcher -f /run/user/1001/etc. etc.
Note that it seems to be possible to work around the issue (without shutting down and restarting the affected Jupyter Notebook) by launching a new orca server from the console (as per the command shown at the end of the trace above). In my case the command was:
/home/username/anaconda3/bin/orca serve -p 32909 --plotly /home/username/anaconda3/lib/python3.6/site-packages/plotly/package_data/plotly.min.js --graph-only --mathjax https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js