oracle / fastr

A high-performance implementation of the R programming language, built on GraalVM.
Other
623 stars 64 forks source link

Unable to install shiny on FastR 20.1.0 CE #162

Open Alain-Bearez opened 4 years ago

Alain-Bearez commented 4 years ago

Despite the package shiny being reported as "100.00% tests pass" on GraalVM Language Compatibility checker, its installation fails.

Can you reproduce with the latest development build?

The error on 20.3.0-dev-20200812_0203 is slightly different from the one on 20.1.0 and might provide more insights about the error cause:

* installing *source* package ?shiny? ...
** package ?shiny? successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
/opt/graalvm-ce-java11-20.3.0-dev/languages/R/bin/INSTALL: line 34: 20367 Done                    echo 'tools:::.install_packages()'
     20368 Killed                  | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --slave --args ${args}

The downloaded source packages are in
    ?/tmp/Rtmp8W1wKr/downloaded_packages?
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("shiny") :
  installation of package ?shiny? had non-zero exit status

Include the following info

The error can be reproduced by using the following Dockerfile: https://gist.github.com/Alain-Bearez/478d61607f9ad275d1f97ac1f179ed16

⨯ docker build \
                           -f Dockerfile.ol8-java11 \
                           --build-arg GRAALVM_PKG="https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/20.3.0-dev-20200812_0203/graalvm-ce-java11-linux-amd64-20.3.0-dev.tar.gz" \
                           --build-arg GRAALVM_VERSION=20.3.0-dev \
                           --output=type=docker \
                           -t cuali/fastr-dev:20.3.0-dev-java11-amd64 \
                           .

Optionally: try to reduce the error

The docker image referred to as cuali/fastr below was produced by the following command:

⨯ docker build \
                           -f Dockerfile.ol8-java11 \
                           --output=type=docker \
                           -t cuali/fastr:20.1.0-java11-amd64 \
                           .

First attempt to reduce the error, with complete set of installation options:

⨯ docker run --rm -it cuali/fastr Rscript -e "install.packages('shiny', INSTALL_opts='--no-R --no-libs --no-help --no-data --no-demo --no-exec --no-test-load')"
Content type 'application/octet-stream' length 3168035 bytes (3.0 MB)
* installing *source* package ?shiny? ...
** package ?shiny? successfully unpacked and MD5 sums checked
** using staged installation
** inst
** building package indices
* DONE (shiny)

The downloaded source packages are in
    ?/tmp/Rtmpxd7b0a/downloaded_packages?
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

Second attempt to reduce the error, after removal of the --no-R installation option:

⨯ docker run --rm -it cuali/fastr Rscript -e "install.packages('shiny', INSTALL_opts='--no-libs --no-help --no-data --no-demo --no-exec --no-test-load')"
Content type 'application/octet-stream' length 3168035 bytes (3.0 MB)
* installing *source* package ?shiny? ...
** package ?shiny? successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
/bin/sh: line 1:   133 Killed                  R_TESTS= '/opt/graalvm-ce-java11-20.1.0/languages/R/bin/R' --no-save --slave 2>&1 < '/tmp/RtmpJspe4c/file9k77oozxpurs'
ERROR: lazy loading failed for package ?shiny?
* removing ?/opt/graalvm-ce-java11-20.1.0/languages/R/library/shiny?

The downloaded source packages are in
    ?/tmp/RtmpPS9wG8/downloaded_packages?
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("shiny", INSTALL_opts = "--no-libs --no-help --no-data --no-demo --no-exec --no-test-load") :
  installation of package ?shiny? had non-zero exit status
steve-s commented 4 years ago

Hello Alain,

the GraalVM Language Compatibility in the case of R does not always give the correct impression. As you discovered yourself installing some packages is a non trivial endeavor w.r.t. system configuration. Moreover, not all packages use a testing framework, so in the beginning we decided to just run the test scripts no matter what test framework (if any at all) they use and try to somehow fuzzy compare the output of FastR vs. GNU-R. This all turns out to be very complex and fragile process, which resulted in some misreported results like the one for Shiny. We'll see if we can improve this, but in the end we may end up removing the R packages reports from the website, because as your experience shows the fuzziness of the reported results may do more harm than good. Sorry for the confusion this may have caused.

Now for Shiny itself: Shiny should install on FastR and FastR can run some basic examples. We think this is a solid evidence that FastR supports all the important and sometimes quirky and unintuitive R features and so when we claim that FastR can run R code really fast, we're not cheating by ignoring some important aspect of R like lazy evaluation. We don't consider FastR ready for a prime time with such complex packages like Shiny -- we don't extensively test them w.r.t. correctness and performance. Note that execution of R native extensions is often slower on FastR due to frequent switches between native code and JVM. Unfortunately, these switches are fast in GNU-R and package authors are not motivated to minimize them and to use R instead of C/C++.

I've tried installing Shiny on the following Docker image that we use for testing compatibility with Oracle Linux 8 and it seems to work fine:

FROM oraclelinux:8

RUN (yum -y check-update || true) && \
  yum -y groupinstall 'Development Tools' && \
  yum -y install gcc-gfortran

RUN mkdir /graalvm
COPY ./graalvm /graalvm # there must be local copy of GraalVM with FastR installed next to the Dockerfile

ENTRYPOINT ["/graalvm/bin/R"]

I've used JDK8 based GraalVM version 20.2. I see you use JDK11 based GraalVM. Could you try if using JDK8 would resolve your problem? That would mean there is some issue with JDK11 that we would need to investigate.