save plotly images from Rstudio in docker, get error ! System command 'orca' failed

I have RStudio in docker, and am trying to save a plotly image using orca. I installed orca following python 3.x - Docker and Plotly - Stack Overflow.

I build and start successfully, and to check if I can save an image I run:

library(plotly)
library(processx)
fig <- plot_ly(z = ~volcano) %>% add_surface()
orca(fig,"t.png")

Whereupon I receive the following error:

Error in `processx::run("orca", "-h")`:
! System command 'orca' failed
---
Exit status: 127
Stderr: <empty>
---
Type .Last.error to see the more details.
Warning message:
'orca' is deprecated.
Use 'kaleido' instead.
See help("Deprecated") 
> .Last.error
<system_command_status_error/rlib_error_3_0/rlib_error/error>
Error in `processx::run("orca", "-h")`:
! System command 'orca' failed
---
Exit status: 127
Stderr: <empty>
---
Backtrace:
1. plotly::orca(fig, "t.png")
2. plotly:::orca_available()
3. plotly:::correct_orca()
4. processx::run("orca", "-h")
5. processx:::throw(new_process_error(res, call = sys.call(), echo = echo, …
> 

Is there another way to install orca, or save a plotly image in RStudio running in docker?

My full dockerfile:

FROM rocker/verse

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends build-essential libpq-dev python3.9 python3-pip python3-setuptools python3-dev
RUN pip3 install --upgrade pip

ADD . ./home/rstudio

ADD requirements.txt .
ADD install_packages.r .

# Miniconda and dependencies
RUN cd /tmp/ && \
        wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
        bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 && \
        /root/miniconda3/condabin/conda install -y python=3.7
ENV PATH=$PATH:/root/miniconda3/bin

#RUN npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads

# installing python libraries
RUN pip3 install -r requirements.txt

# installing r libraries
RUN Rscript install_packages.r

RUN if ! [[ "16.04 18.04 20.04 21.04 21.10" == *"$(lsb_release -rs)"* ]]; \
then \
    echo "Ubuntu $(lsb_release -rs) is not currently supported."; \
    exit; \
fi

RUN sudo su
RUN apt-get update && apt-get install -y gnupg2

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

RUN curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list

RUN exit
RUN sudo apt-get update
RUN sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17

RUN chmod -R 777 /home/rstudio

# Download orca AppImage, extract it, and make it executable under xvfb
RUN apt-get install --yes xvfb libgconf-2-4
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
RUN chmod -R 777 /home/squashfs-root/

Is this in $PATH? If not, I'd expect to see exactly that error. If it is, rename to just orca.

thanks for suggestion

I added the line ENV PATH="${PATH}:/home/orca-1.1.1-x86_64.AppImage" to my docker image, but still ran into the same error in my container.

Maybe I am misunderstanding.

Hi, Francine

What happens in the terminal with

./orca-1.1.1-x86_64.AppImage

from your home directory? Does it run?

Is

which(orca-1.1.1-x86_64.AppImage)

returning the appimage from the $HOME directory?

If yes to first and no to second, the order of your $PATH may need adjusting. Here's an example supposing I had orca installed both in my home directory and one of its subdirectories.

subdirectory firsst

/home/roc/local/bin:/home/roc

/home/roc/local/bin/orca will execute

Home first

home/local:/home/roc/local/bin

vice versa

This is editable in .bashrc or .zshrc depending on which shell you are using. Come back if you continue to have issues.

Hi technocrat

Thanks for your continued assistance.

Please see results of suggested commands.

It seems that it did not get installed from my container?

Maybe it needs permission changes. From the home directory

ls -l orca-1.1.1-x86_64.AppImage

will confirm (or not) if the file is in that directory. If it is, the permissions should have an x flag like

-rwxrwxr-x 1 roc roc       218 May 11  2022 send2trash*

and the user/user group shouldn't be set to root or another account needing su to run.

potentially an issue with FUSE?

Well, there are a ton of issues with FUSE, apparently. To start

AppImages require FUSE version 2 to run. Filesystem in Userspace (FUSE) is a system that lets non-root users mount filesystems.

BUT

Warning: Do not install the fuse package as of 22.04 or you may break your system

Where did you acquire orca? Is it from this repo? And I missed this: are you troubleshooting from your system terminal or from a terminal in a docker container?

yes, wget is from same location

Yes, I am troubleshooting from docker container.

Ah! It ended up in usr/bin/orca so you should be able to confirm with which orca

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.