-
-
Notifications
You must be signed in to change notification settings - Fork 43
Can plotly.io.to_image used inside a docker container? #150
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
Comments
Hi @WurtzJd, Inside a docker container you'll probably need to run orca with xvfb-run. See https://github.com/plotly/orca/blob/80855093193afba09a4dbebaa7bae776be88e15e/README.md#linux-troubleshooting-headless-server-configuration in the README. Also, in case it's useful to you, here's the docker configuration used by the plotly team uses https://github.com/plotly/orca/blob/master/deployment/Dockerfile |
@WurtzJd did using |
@WurtzJd would you see a lot of value in us publishing an official Docker image for Orca? In the meantime, you can find an example Dockerfile there: https://github.com/plotly/orca/blob/master/deployment/Dockerfile |
@jonmmease , @antoinerg, it would be very useful to have a simple docker image indeed |
I also fail to use plotly orca outside docker when ssh into another machine. pio.write_image returns:
I just tried to install conda again, following the Git README:
Now when I try orca --help I get And |
Trying to get orca installed on an ubuntu docker image is a nightmare! Has anyone been able to do it? |
@scottwilson312 I've been on two sprints to try and do this in a docker image from Jupyter for use in a MyBinder session, and share your frustration. Dockerfile for repo: https://github.com/electropy/notebooks/blob/orca/Dockerfile At this point, I'm getting two issues. In a terminal:
And trying to use it in a Juptyer Notebook regardless, seems like it doesn't see orca in the python/jupyter path:
This has been so painful and tiring, but I really really really want this feature to work :/ |
I've tried other variants of installations (e.g. from conda), but they didn't work because MyBinder sessions are headless, I think. |
To solve the Fuse error to try running docker as privileged
…On Fri, Apr 12, 2019, 7:02 AM Mathieu Boudreau ***@***.***> wrote:
I've tried other variants of installations (e.g. from conda), but they
didn't work because MyBinder sessions are headless, I think.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#150 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/APty_nrAwIeAxOxtCGcKZbXudb526xVZks5vgJHcgaJpZM4Yz1YV>
.
|
Unfortunately, I don't think I have control over that as the MyBinder service is what's running the docker image after it's built; I don't set the commands myself. Thanks though! |
Hi @mathieuboudreau, From your error messages, it looks like core issue is that your docker container is unable to use fuse to mount the AppImage. The AppImage format is really an archive containing a potentially complex file structure of the program and all the dependencies. When you run an AppImage, the image file is automatically mounted using fuse in an unarchived form so that the executable inside the archive can be run like a normal linux program. I'm not experienced enough with using fuse inside docker to know if there is an easy way to get fuse working, so I'd recommend trying the Something like # Download orca AppImage, extract it, and make it executable under xvfb
RUN wget https://github.com/plotly/orca/releases/download/v1.1.1/orca-1.1.1-x86_64.AppImage -P /home
RUN chmod 777 /home/orca-1.1.1-x86_64.AppImage
# To avoid the need for FUSE, extract the AppImage into a directory (name squashfs-root by default)
RUN cd /home && /home/orca-1.1.1-x86_64.AppImage --appimage-extract
RUN printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /home/squashfs-root/app/orca "$@"' > /usr/bin/orca
RUN chmod 777 /usr/bin/orca Hope that helps! |
Thanks for that tip @jonmmease ! Unfortunately, now I get a |
When you run |
I tried to |
Over in plotly/plotly.py#1523 I started working on an update to plotly.py to automatically detect whether it should try to use Xvfb when calling orca. Basically, if we're on Linux, there's no X11 server active (based on the lack of a With this branch, I was able to get the orca conda package working in Colab (plotly/plotly.py#1523 (comment)). I'm wondering if this approach would work on binder since the conda package isn't using the AppImage format. |
And one idea with your current approach. I opened up the binder link and opened a terminal and ran:
Based on this, it looks like the permissions you set on the AppImage file were set properly. I think the problem here might be that the top-level squashfs-root directory is still locked down to Try replacing RUN chmod 777 /home/squashfs-root/app/orca with RUN chmod -R 777 /home/squashfs-root/ to recursively open up the permission of the entire directory structure. |
AMAZING! It finally works! Thanks so much @jonmmease !! I needed one more apt-get install for it to work using my base notebook ( I stripped my notebook to the bare essentials (more or less), and uploaded it in a separate repo along with an example Jupyter Notebook from Plotly's own "Static image export in python" example. Dockerfile: https://github.com/mathieuboudreau/orca-plotly-dockerfile/blob/master/Dockerfile |
That's great @mathieuboudreau, and thanks for making that repo to help other folks work through this in the future! |
Awesome @mathieuboudreau! |
The base docker image that my dockerfile pulls installs Ubuntu (see here: https://hub.docker.com/r/jupyter/base-notebook/dockerfile), so maybe try what I did? |
When I run the image, Jupyter is launched automatically, any way to stop this from happening? |
@WurtzJd I've only ever used Dockerfiles with MyBinder, which opens Jupyter.
You probable are missing a lot of the additional settings needed (see here: https://hub.docker.com/r/jupyter/base-notebook/dockerfile) What you could maybe do is instead copy the jupyter base notebook file: https://hub.docker.com/r/jupyter/base-notebook/dockerfile Remove the "Configure container startup" lines from it:
Then copy-past my own Dockerfile at the end (minus the FROM... at the top). https://github.com/mathieuboudreau/orca-plotly-dockerfile/blob/master/Dockerfile If I were to guess, this would have all the same setup as me, but without opening jupyter. |
I followed your tips, but instead I just added the line "CMD ["bash"]" at the end of your dockerfile, and it works like a charm. Running Orca in docker is going to be so useful, many many thanks for working out and sharing the solution! |
It is possible to also implement's @mathieuboudreau's solution to using plotly.io / Plotly's orca in MyBinder.org-served binder sessions without the need for a Dockerfile. In the example here I use Repo: https://github.com/fomightez/orca-plotly-binderized |
Thank you for everyone who blazed the trail here. This was painful. I'm posting my full docker RUN command that performs all necessary steps to make this work, hopefully this will be useful to others. You should be able to copy and paste this into your docker file. This is built on a pretty minimal container with python 3.6 and Ubuntu, so I believe all of the libraries and dependencies you will need are included here. This is the first operation in my Dockerfile.
|
Thank you @davidparks21 , this worked! |
plotly export with orca added according to: plotly/orca#150
Thank you all, just wanted to point out that I also needed to install
|
None of the suggestions here worked for me. Maybe it is because I'm using Ubuntu 16.04 and its libnss3 is not compatible with the chrome version used by Orca? I tried using more recent debs of libnss3 but that didn't work either. To even reach the libnss3 error I had to follow the instructions of both davidparks21 and jonmmease. Perhaps libnss3 should be packaged with the AppImage? Regardless, better documentation on running Orca in a docker container would be much appreciated. |
Just tested on 18.04, it works. |
Thanks @simone-pignotti, I added xauth to the docker RUN command I posted at #150 (comment), it was indeed pre-installed on my container. |
@davidparks21 thanks for your dockerfile, i am using R from inside docker weirdly running orca on bash works but running orca from inside R in the container gives the following error: "/opt/orca/squashfs-root/app/orca: symbol lookup error: /opt/orca/squashfs-root/app/orca: undefined symbol: _ZN4node20g_upstream_node_modeE\n" does this ring a bell ? I havve followed different solutions with no avail so far thank you |
@vxg20 unfortunately I am not going to be much help there, I'm running under Python. I never tested anything under R. |
I'm having trouble with this step. After extracting from the latest app image version 1.3.1, I do not have this path - squashfs-root/app/orca. I have something called squashfs-root/AppRun as well as squashfs-root/orca and squashfs-root/resources/app/orca. I am not sure where to point usr/bin/orca. Would appreciate some help with this. |
Hello @choprashweta, I think you can link it to Note that if you are running as |
Share a latest version, there is no problem to use in COPY ./orca-1.3.1.AppImage /usr/src/orca.AppImage
WORKDIR /usr/src
RUN apt-get update && \
apt-get install -y --no-install-recommends \
xvfb xauth libgtk-3-0 libxtst6 libxss1 libgconf-2-4 libnss3 libasound2 && \
./orca.AppImage --appimage-extract && rm orca.AppImage && \
printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24 +extension RANDR +extension GLX" /usr/src/squashfs-root/orca "$@" --no-sandbox' > /usr/bin/orca && \
chmod +x /usr/bin/orca In general, the root user used in docker, so I added the In addition, in the latest python plotly package, it seems to be trying to automatically solve the running problem, such as trying to use
But this command seems to be wrong. The I hope the official can check whether the automatic solution has the parameter problem I mentioned. |
I successfully got orca (from R) to run inside a docker with the appImage and using xvfb-run and the --appimage-extract-and-run option. It works for most plotly graphs except for the ones using webGL like the SPLOM graph or scatterGL rendered graphs. anyone have the same problem? anyone knows a solution? I am using this as /usr/local/bin/orca: |
Hello @antoinerg, I am not running docker image, but on aws EC2 instance (based on anaconda-python3 image). I tried I use
However But
I have installed Xvfb using sudo, run all commands as ec2-user instead of root, b/c on anaconda-python3 image, ec2-user is the owner of all the conda stuff. Any idea why I also tried orca-1.2.1-x86_64.AppImage in place of orca-1.3.1.AppImage to no avail. Orca seems like a big hassle to use, can't find any successful use case examples beyond windows and ubuntu, and no help on here nor stackoverflow nor plotly community. |
@davidparks21 I really want to thank you for posting that Dockerfile. I spent most of this morning and afternoon trying to do the exact same thing. Getting orca set up in a Docker container was incredibly painful. |
can this be converted to a alpine image? struggling my ass off trying to convert it.
|
FYI. A docker image already exists. Just do
…> docker pull quay.io/plotly/orca
On Sun, 16 Aug 2020 at 14:41, JaredOzzy ***@***.***> wrote:
can this be converted to a alpine image? struggling my ass off trying to
convert it.
# Plotly depedencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
wget \
xvfb \
xauth \
libgtk2.0-0 \
libxtst6 \
libxss1 \
libgconf-2-4 \
libnss3 \
libasound2 && \
mkdir -p /opt/orca && \
cd /opt/orca && \
wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage && \
chmod +x orca-1.2.1-x86_64.AppImage && \
./orca-1.2.1-x86_64.AppImage --appimage-extract && \
rm orca-1.2.1-x86_64.AppImage && \
printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /opt/orca/squashfs-root/app/orca "$@"' > /usr/bin/orca && \
chmod +x /usr/bin/orca
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#150 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEVULWVKGZSGDMJOM75KQV3SA7HWVANCNFSM4GGPKYKQ>
.
|
Hi there! I made a dash app that has the option to download the plot that is shown, and thus uses orca. Now I'm trying to dockerize the app. Thanks to @davidparks21 and @459217974 I was able to fix the errors that kept appearing when dealing with orca installation. The problem is that now I'm trying to follow one Docker security “best practice” of creating a non-root user in the following way: RUN useradd appuser && chown -R appuser /usr/src/app
RUN chown -R appuser /opt/orca
USER appuser But when I try to run "orca --help" in the container shell I get the following: A JavaScript error occurred in the main process
Uncaught Exception:
Error: Failed to get 'appData' path
at App.app._setDefaultAppPaths (/opt/orca/squashfs-root/resources/electron.asar/browser/api/app.js:54:43)
at Object.<anonymous> (/opt/orca/squashfs-root/resources/electron.asar/browser/init.js:133:5)
at Module._compile (internal/modules/cjs/loader.js:786:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
at Module.load (internal/modules/cjs/loader.js:645:32)
at Function.Module._load (internal/modules/cjs/loader.js:560:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:850:10)
at internal/main/run_main_module.js:17:11 Does anyone faced the same problem? Thanks in advance! |
I'll just mention that we're basically replacing Orca with the new Kaleido project (https://github.com/plotly/Kaleido) which is significantly easier to install in docker containers and is our new recommended way forward for this kind of thing :) |
Oh! I wasn't aware of that! It seems much much easier. Thank you very much for the tip @nicolaskruchten! I'll try it right way. EDIT: It worked like a charm! Really amazing after all the strugling with orca. Thanks again @nicolaskruchten for pointing it out! |
@nicolaskruchten Kaleido is great, and very easy to use here after spending way too much time wrangling orca. Thanks for the rec! |
Orca can be used under Docker. See example Dockerfile as well as already built images! |
thanks @nicolaskruchten; all I needed was pip install kaleido and not to use |
This is pretty much an artifact of the order in which things were released... if you don't have |
alright, not sure I'm following though…
seems better for the error msg to mention kaleido, or [orca || kaleido]? |
Ah I see, indeed the way the defaults work right now, without Thanks for following up @ryan-williams :) |
Yeah, I think I'd actually be in favor of dropping Orca support in v5. AFAIK, we haven't come across any reports from users who are using orca successfully but are unable to use Kaleido. |
That seems a bit aggressive to me... maybe there are some folks who got Orca accepted by IT at great effort and haven't switched and just haven't told us about it. But we can probably shuffle the logic around to make it even less available i.e it's Kaleido and Kaleido messages unless you have Orca installed and not Kaleido, and even then, all the Orca messages say "instead of fixing this, try Kaleido!" ? |
@jonmmease Is there any appImage we can wget for arm processor? |
When using plotly.io.to_image inside a docker container I get :
"When used on Linux, orca requires an X11 display server, but none was detected. Please install X11, or configure your system with Xvfb."
I tried adding apt-get install -y x11-apps but it does not help.
Cheers
The text was updated successfully, but these errors were encountered: