I have tried to install the MODIStsp package using this code:
devtools::install_github("ropensci/MODIStsp")
# Downloading GitHub repo ropensci/MODIStsp@master
#Installing 22 packages: bitops, cairoDevice, data.table, foreach, gdalUtils, gWidgets, gWidgetsRGtk2, #iterators, pacman, R.methodsS3, R.oo, R.utils, raster, rgdal, rgeos, RGtk2, sp, stringi, stringr, xml2, #xts, zoo
# .................. later ...................
# * DONE (bitops)
#* installing *source* package ‘cairoDevice’ ...
#** package ‘cairoDevice’ successfully unpacked and MD5 sums checked
#checking for pkg-config... pkg-config
#ERROR: gtk+2.0 not found by pkg-config.
#ERROR: configuration failed for package ‘cairoDevice’
#* removing ‘/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.5/cairoDevice’
#Error in i.p(...) :
# (converted from warning) installation of package ‘cairoDevice’ had non-zero exit status
The MODISstp developers state here that:
To install MODIStsp
on Linux, you have to first install the following required dependencies:
Cairo
>= 1.0.0, ATK
>= 1.10.0, Pango
>= 1.10.0, GTK+
>= 2.8.0, GLib
>= 2.8.0 (required by package RGtk2
)
Curl
(required by package curl
)
GDAL
>= 1.6.3, PROJ.4
>= 4.4.9 (required by package rgdal
)
On Debian and Ubuntu-based systems, to install those packages open a terminal and type:
sudo apt-get install r-cran-cairodevice r-cran-rgtk2 libcairo2-dev libatk1.0-dev libpango1.0-dev libgtk2.0-dev libglib2.0-dev libcurl4-openssl-dev libgdal-dev libproj-dev
Two questions:
Could you please install the MODISstp package in my "remotesensing" project?
If not, it is possible to get a sudo password to install package dependencies?
Thanks for your help.
josh
October 25, 2018, 5:04pm
2
Keep in mind that there is no display with rstudio.cloud, so gtk has nowhere to render.
We will keep this in mind, but are unlikely to do anything in the short term.
Hi,
this is a known problem, preventing installing MODIStsp
on "headless" systems. See:
opened 10:14PM - 05 Nov 17 UTC
closed 04:48PM - 08 Nov 17 UTC
Hi there again,
The basic usecase addressed here is running MODIStsp(gui=FALS… E) on a remote headless server.
I am running MODIStsp(gui=FALSE) on a remote headless linux redhat server. I connect to the server with X11 as "ssh -X user@server" and run the package in a screen session. All is well while my ssh session is connected and MODIStsp() runs as expected. If I disconnect from the ssh session and leave the code to run in my screen session (as is a common usecase) I get the following error and failure of MODIStsp to load:
```
Loading required package: MODIStsp
R session is headless; GTK+ not initialized.
(R:11128): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error: package or namespace load failed for ‘MODIStsp’:
.onLoad failed in loadNamespace() for 'cairoDevice', details:
call: fun(libname, pkgname)
error: GDK display not found - please make sure X11 is running
Error in MODIStsp(gui = gui, options_file = options_file) :
could not find function "MODIStsp"
Execution halted
```
I assume this is because X11 is no longer activated as I have disconnected from my ssh session. This may be a workaround to keep x11 alive: https://askubuntu.com/questions/817082/how-to-keep-a-remote-x11-app-running-after-disconnecting-ssh, I will experiment.
However, I guess the question is why is X11 required if gui=FALSE switch is set? All the errors are related to gui packages, no?
Thanks again for the hard work and a great package!
Joel
opened 11:50AM - 09 Aug 18 UTC
closed 09:51AM - 04 Sep 20 UTC
enhancement
I am trying to use MODIStsp for running a large batch job on a remote Linux serv… er while logged in via ssh, i.e. solely on the command line without access to a graphical user interface. I am using the standalone bash/Rscript version. Unfortunately without an available X11 output, both the installation and (after successfully installing the package via X11 forwarding) the loading of MODIStsp fail due to the requirements of loading the GTK/cairoDevice, even when one is interested in only using the package from the command line entirely without GUI. This is true both for an interactive session and when calling the standalone bash/Rscript version directly from the command line without GUI. See below for an example.
Is this a known issue? Or can MODIStsp not be used in command line-only mode logged into a server due to its dependencies on GTK? Is there a workaround other than forwarding X11 to the local host (everything works fine when doing the latter but for various reasons I'd prefer not to do that)? I imagine ideally the GTK libraries should only be loaded if the user requests the GUI and remain unloaded as long the user works on the command line.
Example of simply trying to load the package without X11 forwarding:
```
> library(MODIStsp)
R session is headless; GTK+ not initialized.
(R:13143): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error: package or namespace load failed for ‘MODIStsp’:
.onLoad failed in loadNamespace() for 'cairoDevice', details:
call: fun(libname, pkgname)
error: GDK display not found - please make sure X11 is running
```
Example of trying to run a saved json configuration using the standalone command line tool:
```
philipp@prod-cn-login01 - ~/temp/modistsptest
>./MODIStsp.sh -g -s "modis_lst_nordic.json"
/homevip/philipp/R/x86_64-pc-linux-gnu-library/3.4/MODIStsp/ExtData/Launcher
Loading required package: MODIStsp
R session is headless; GTK+ not initialized.
(R:5726): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
Error: package or namespace load failed for ‘MODIStsp’:
.onLoad failed in loadNamespace() for 'cairoDevice', details:
call: fun(libname, pkgname)
error: GDK display not found - please make sure X11 is running
Loading required package: jsonlite
Loading required package: methods
Error in MODIStsp(gui = gui, options_file = options_file) :
could not find function "MODIStsp"
Execution halted
```
On Travis-CI, I managed to get the build working by adding this to the yaml config:
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
, but I do not know if it helps in this case.
I am planning to make a new "GUI-less" branch of the package to address the issue, allowing to use the package via scripting (using an options file) also on headless systems. I'll keep you posted.
Sooner or later, I also plan to replace the gtk GUI with a shiny interface, but that will take time....
1 Like