Skip to content
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

525: plotly.js error #223

Open
Zamalkawwy opened this issue Mar 28, 2019 · 3 comments

Comments

@Zamalkawwy
Copy link

commented Mar 28, 2019

Running my python script in a Dockerfile is giving me this error.

> /opt/conda/bin/orca: line 11:    76 Terminated              xvfb-run -a /opt/conda/bin/plotly-orca "$@"
> Traceback (most recent call last):
>   File "bot/discordBot.py", line 15, in <module>
>     import chart as c
>   File "/bot/chart.py", line 89, in <module>
>     print(get_plot("BTC"))
>   File "/bot/chart.py", line 83, in get_plot
>     pio.write_image(fig, 'fig1.png')
>   File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1512, in write_image
>     validate=validate)
>   File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1417, in to_image
>     raise ValueError(err_message)
> ValueError:
> The image request was rejected by the orca conversion utility
> with the following error:
>    525: plotly.js error

My script runs fine on my local machine so I don't believe it's my code. Yet replacing my code pio.write_image(fig, '/images/fig1.png',width=995, height=249) with this pio.write_image(go.Figure(data=[{'y': [1, 3, 2]}]), 'simple_fig.png')
produces a file.

My Dockerfile looks like this:

FROM continuumio/miniconda3:latest
USER root

RUN     \
    apt-get update                              && \
    apt-get install -y gcc && \
    apt-get install -y poppler-utils


#    apt-get install -y libgtk2.0-0              && \
#    apt-get install -y libgconf-2-4             && \
#    apt-get install -y xvfb


#
# for Orca
#

RUN apt-get update && apt-get install -y --no-install-recommends \
        gnupg curl ca-certificates xz-utils wget libgtk2.0-0 libgconf-2-4 \
        && rm -rf /var/lib/apt/lists/* && apt-get clean

RUN apt-get install -y libgtk2.0-0              && \
    apt-get install -y libgconf-2-4             && \
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' && \
    apt-get update -y && \
    apt-get install -y google-chrome-stable xvfb  && \
    rm -rf /var/lib/apt/lists/* && apt-get clean

USER root

RUN \
    conda update -n base conda                  &&  \
    conda install -c plotly plotly              &&  \
    conda install -c plotly plotly-orca poppler psutil

USER root

# Set up a wrapper for orca (see https://github.com/plotly/orca) in an X11-less environment

RUN \
    mv /opt/conda/bin/orca /opt/conda/bin/plotly-orca

COPY orca /opt/conda/bin/orca

RUN chmod a+x /opt/conda/bin/plotly-orca
RUN chmod a+x /opt/conda/bin/orca

RUN orca --help

I have yet to find a working instance of orca running in a Docker container. What could be causing the errors above?

I should mention that issues arise with my code in other docker containers that have orca installed. This is the closest I've gotten it to working flawlessly and I am unsure if there is a dependency issue or if there is an extra step needed to take in a docker image.

@bjodah

This comment has been minimized.

Copy link

commented Aug 13, 2019

I was struggling with this today, I got it working by passing additional server args to xvfb-run, here's my orca script (on my $PATH):

#!/bin/bash                                                                                             
LIBGL_DEBUG=verbose xvfb-run --server-args "-screen 0 1920x1080x24" -a /home/bjorn/Downloads/orca-1.2.1-x86_64.AppImage "$@"

For reference, this answer led me to trying this: https://unix.stackexchange.com/a/283129/119480

@ZilinXiang

This comment has been minimized.

Copy link

commented Aug 17, 2019

I encountered the same problem. But the reason is weird, it maybe helps you. I changed the size of the font, some values could lead to the problem. Maybe you can set a small font size.

@antoinerg

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2019

I encountered the same problem. But the reason is weird, it maybe helps you. I changed the size of the font, some values could lead to the problem. Maybe you can set a small font size.

@ZilinXiang I would like to better understand the issue you faced. Could you provide me with the JSON of the figure exhibiting this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.