ocbe-uio / DIscBIO

A user-friendly R pipeline for biomarker discovery in single-cell transcriptomics
Other
12 stars 5 forks source link

DIscBIO doesn't install #21

Closed wleoncio closed 3 years ago

wleoncio commented 3 years ago

Describe the bug

Installation of DIscBIO from CRAN fails.

Steps to Reproduce

From an R interactive session, run:

install.packages("DIscBIO")

Expected output

Output that ends in:

* DONE (DIscBIO)

The downloaded source packages are in
        ‘/tmp/Rtmpgn8yf4/downloaded_packages’

The name of the temporary directory, Rtmpgn8yf4, will probably be different in your case.

Obtained output

The downloaded source packages are in
        ‘/tmp/Rtmpgn8yf4/downloaded_packages’
Warning messages:
1: In install.packages("DIscBIO") :
  installation of package ‘rJava’ had non-zero exit status
2: In install.packages("DIscBIO") :
  installation of package ‘RWekajars’ had non-zero exit status
3: In install.packages("DIscBIO") :
  installation of package ‘RWeka’ had non-zero exit status
4: In install.packages("DIscBIO") :
  installation of package ‘DIscBIO’ had non-zero exit status
wleoncio commented 3 years ago

Explaining the error

This is common to all R packages dependent on rJava, which is often a PITA to install. If you try to install another such package, e.g. rcdk, a similar problem will occur.

This type of error usually happens because the user's R installation cannot properly see all Java paths. It is an Operating System problem, which CRAN has no control over and thus doesn't prevent a package from being published on CRAN.

How to solve the issue

It is up to the user to solve the issue for their Operating System, and sites like stackoverflow are full of posts relating the problem and proposing solutions. Also, taking a closer look at the full output will often lead to some proposals from R itself. For instance, on Linux (and maybe macOS) you should:

  1. Install openjdk (including sources, which may be in a separate package from the JRE)
  2. Run R CMD javareconf -e (or, alternatively, sudo R CMD javareconf) for R to search for the proper Java paths.
  3. If the previous step fails (often due to a failure in finding jni.h), run echo $JAVA_HOME to make sure the environment variable is pointing to a valid openjdk version
  4. Reload your R session

Once install.packages("rJava") runs successfully, you'll be able to install DIscBIO. If it doesn't, try closing and reopening R (so it picks up the proper Java paths). If you still run into problems, please post below.