Hi all,
I am in the process of creating a Shiny app, which reads in Excel files, renames them and then converts them into PDF files. The conversion step is performed by LibreOffice at the command line with:
libreoffice --convert-to pdf myfile.xlsx
Since I needed LibreOffice as an external dependency for my project, I could not use shinyapps.io since there is no straightforward way to install LibreOffice on there. Therefore, I resorted to launching an AWS EC2 Ubuntu instance and installed LibreOffice's latest version. Of course, I also installed Shiny Server so my app could be hosted on there. I need to mention that I am a beginner at using Shiny server on an AWS EC2 instance and using the Unix command line overall.
Now, here is my issue. When I connect to the server via ssh and use LibreOffice to convert some Excel files to PDF, it works perfectly. However, when I try to access LibreOffice via the launched Shiny app via command line functions, it seems that the app does not have access to the software. I verified whether Shiny realizes that LibreOffice is installed on the server with:
which libreoffice
and it does since the response is
/usr/bin/libreoffice
But it appears as though Shiny is unable to use it for some reason. The error message I get even when I try to determine LibreOffice's version from Shiny with
libreoffice --version
is
Executing 'libreoffice' failed with status 127
which means that the libreoffice
command was not found according to my research. Once again, when I'm on the server using the command line, everything works perfectly.
It baffles me how Shiny knows that the software is installed, but cannot use it. I even verified the permissions on libreoffice
from Shiny with
ls -l -H /usr/bin/libreoffice
and obtained
-rwxr-xr-x 1 root root 6731 Mar 1 08:39 /usr/bin/libreoffice
I am no expert in Unix/Linux, but I think that this means that all users have access to it?
My question, then, is: How do I get Shiny to use third party software installed on a server?
It may also be important to mention that I use the wonderful sys package by Jeroen Ooms for all my command line needs instead of using system2()
in base R.
Thank you all in advance for your help.