I'm trying to host a Shiny app that works locally but doesn't once it's hosted via shinyapps.io. I suspect that the problem is with various dependencies. It uses reticulate to source a bunch of Python functions, and one of those functions calls exiftool from the terminal via the subprocess module. But exiftool doesn't come pre-installed (locally, I just did a sudo apt-get install exiftool). Is there any way to install it on the shinyapps.io instance as well?
Correct, exiftool
is not installed by default.
The normal mechanism by which additional system packages are installed is based on the installation of an R package that requires it. In this case, there is exifr. Once shinyapps-package-dependencies had an install script for exifr
, you could then add library(exifr)
to your code, and the Python call out would have it available.
Thanks. Adding a library(exifr)
seems to have installed exiftool, but for some reason I can't seem to call it via Python/reticulate. For example, if I have this in my script:
library(reticulate)
library(exifr)
subprocess <- import('subprocess')
exiftool_path <- getOption('exifr.exiftoolcommand')
subprocess$check_output(paste(exiftool_path, 'FLIR_350.jpeg'))
Then I get the following message:
Using ExifTool version 10.61
Error in value[[3L]](cond) : OSError: [Errno 2] No such file or directory
Detailed traceback:
File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
No such errors when running locally.
Is there a way to access the terminal in a shinyapps.io instance?
EDIT: I decided to instead just dump exiftool files in the app folder, and after a chmod
it works. I'm guessing that if I do a chmod
on whatever getOption('exifr.exiftoolcommand')
returns, I can use that instead of dumping exiftool files into the app directory.
Thanks for your help.
There is no terminal available for shinyapps.io.
You can issue calls from R to inspect the system though.
That said, you might check the value of exiftool_path
, for me, locally, it is:
> library(exifr)
Using ExifTool version 10.61
> getOption('exifr.exiftoolcommand')
[1] "'perl' '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/exifr/exiftool/exiftool.pl'"
and so I am not surprised that passing it as such isn't quite working.