plotly / orca

Command line application for generating static images of interactive plotly charts
MIT License
293 stars 40 forks source link

complete failure to run orca at all on Linux #330

Open FlorinAndrei opened 4 years ago

FlorinAndrei commented 4 years ago

Ubuntu 16.04 - technically a "headless" system, but it does run a lightdm / unity-greeter on display :0. It just doesn't have a monitor attached. I ssh into it.

orca is installed via conda, along with Plotly.

(base) c19@server:~$ orca --help
(base) c19@server:~$ ~/miniconda3/lib/orca_app/orca --help
(base) c19@server:~$

Nothing whatsoever. Not even an error message.

I tried running Xvfb :1 in another ssh session, or Xvfb :1 & in the same session, then run orca - still nothing.

What are the minimum viable steps to get this thing running on Linux? Where is that stuff documented?

FlorinAndrei commented 4 years ago

Okay, I made some "progress":

(base) c19@server:~$ /usr/bin/xvfb-run --auto-servernum --server-args '-screen 1 640x480x24 +extension RANDR +extension GLX' /home/c19/miniconda3/bin/orca serve -p 42871 --plotly /home/c19/miniconda3/lib/python3.7/site-packages/plotly/package_data/plotly.min.js --graph-only --mathjax https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js
Spinning up server with pid: 18696
Trace/breakpoint trap (core dumped)
(base) c19@server:~$

It crashes with no clue as to why.

FlorinAndrei commented 4 years ago

I installed Orca with Docker on Linux (Ubuntu 16.04), launched it like this...

docker run -d -p 9091:9091 quay.io/plotly/orca

...and then this code works just fine, it makes the test map:

https://gist.github.com/FlorinAndrei/10ac545b7bdffc846d93ac572cb4b37a

But then I tried to run my main repo:

https://github.com/FlorinAndrei/c19

Edit world.py and replace workers = psutil... with workers = 1. Edit workers.py and add this to the top of the make_map() function:

def make_map(arg_list):

  pio.orca.config.server_url = "http://localhost:9091"
  pio.orca.config.use_xvfb = False

Then run python world.py. This is where the failures begin.

Sometimes it errors out without generating a single map. Other times it makes like 4 or 5 maps, but then goes:

Traceback (most recent call last):
  File "/home/c19/miniconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1562, in to_image
    figure=fig_dict, format=format, scale=scale, width=width, height=height
  File "/home/c19/miniconda3/lib/python3.7/site-packages/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/home/c19/miniconda3/lib/python3.7/site-packages/retrying.py", line 212, in call
    raise attempt.get()
  File "/home/c19/miniconda3/lib/python3.7/site-packages/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/home/c19/miniconda3/lib/python3.7/site-packages/six.py", line 703, in reraise
    raise value
  File "/home/c19/miniconda3/lib/python3.7/site-packages/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/home/c19/miniconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1477, in request_image_with_retrying
    raise OSError("522: client socket timeout")
OSError: 522: client socket timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/c19/miniconda3/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/home/c19/miniconda3/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/home/c19/git/c19/workers.py", line 212, in make_map
    fig.write_image(map_full_path, scale=1.0)
  File "/home/c19/miniconda3/lib/python3.7/site-packages/plotly/basedatatypes.py", line 3193, in write_image
    return pio.write_image(self, *args, **kwargs)
  File "/home/c19/miniconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1770, in write_image
    fig, format=format, scale=scale, width=width, height=height, validate=validate
  File "/home/c19/miniconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1575, in to_image
    server_url=config.server_url
ValueError: 
Plotly.py was unable to communicate with the orca server at http://localhost:9091

Please check that the server is running and accessible.

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "world.py", line 363, in <module>
    work_out = p.map(make_map, warglist)
  File "/home/c19/miniconda3/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/c19/miniconda3/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
ValueError: 
Plotly.py was unable to communicate with the orca server at http://localhost:9091

Please check that the server is running and accessible.

What's going on? I'm not even doing multiprocessing, I have a single worker process feeding requests into the Orca server in Docker.

Is Orca actually supposed to be used on Linux at all? Or is it more like a win/mac only type of thing?