[R-sig-Debian] So nearly there, but can't install rJava
Chris Evans
chr|@ho|d @end|ng |rom p@yctc@org
Wed Jan 23 15:46:55 CET 2019
Thanks Sebastian, Johannes and Dirk for your inputs, I think this can be marked [SOLVED] though I still don't understand how it started.
The answer seems to be that something sets an environment variable JAVA.LIBRARY.PATH and this wasn't set correctly. I had never directly done anything to set that so that's odd but what I had done that was causing the problem (I think) is that I had used /etc/environment to set JAVA.HOME (I think that's the spelling). I had set that correctly to point to the openjdk directory but clearly that was causing something else to misset JAVA.LIBRARY.PATH hence the "R CMD config JAVA" instruction not finding the header. When I realised it was that environment variable that was at fault I rebooted the machine to get a clean start (having deleted my /etc/environment) and then "R CMD config JAVA" worked and then install.packages("rJava") worked and I'm happy.
I still don't know what had caused the problem in the first place: I hadn't directly edited anything or changed anything until I hit the first failure of "R CMD config JAVA". After that I used synaptic to add to java related things installed on the machine and I assume somewhere in that process I managed to do something that messed up the environment variable. That seems surprising or frankly unlikely but I know I didn't do anything else that might have done this. I was going through that whole slew of installing other things using apt-get and there was one dependency that I downloaded and compiled with the full ./configure, make, make clean, make install sequence (began with g? can't remember name, the HH package depended on it, I remember that much, perhaps there was an easier way to get that). I can't see that any of that should have hit this environment variable but clearly something I did caused it and it's sorted now.
I can play around with the shiny server now on this local machine and be sure I feel safe with it before I install it on my main server.
Final question to anyone who has read this far: any advice about using the open source shiny server on a Debian stretch server? It's a fairly well equipped VM provided by my ISP and also runs WordPress for several WP sites but nothing much else beyond a one plain old apache site.
Very best all and thanks again,
Chris
----- Original Message -----
> From: "Sebastian Meyer" <seb.meyer using fau.de>
> To: "r-sig-debian" <r-sig-debian using r-project.org>
> Sent: Tuesday, 22 January, 2019 15:22:33
> Subject: Re: [R-sig-Debian] So nearly there, but can't install rJava
> Dear Chris,
>
> Maybe you could try debugging the error
>
>> *** Java interpreter doesn't work properly.
>
> based on the underlying javareconf script.
>
> Scrolling through
>
>> less `R RHOME`/bin/javareconf
>
> we can see that the script exits from
>
>> echo "Java interpreter : $JAVA"
>> jires=`$JAVA -classpath ${tools_classpath} getsp -test`
>> if test "$jires" != "Test1234OK"; then
>> echo "$jires"
>> echo "~*** Java interpreter doesn't work properly.~"|${SED-sed} -e 'y/~/\n/' >&2
>> exit 1
>> fi
>
> From your output we can see that the Java interpreter ($JAVA) has been
> found at /usr/lib/jvm/default-java/jre/bin/java, but the subsequent call
> failed / didn't return the expected test result.
>
> You could try to run that code manually and see what you get and where
> the problem is:
>
>> JAVA=`R CMD config JAVA`
>> echo $JAVA
>> ## /usr/lib/jvm/default-java/jre/bin/java
>
>> R_SHARE_DIR=`R --slave -e 'cat(R.home("share"))'`
>> echo $R_SHARE_DIR
>> ## /usr/share/R/share
>
>> tools_classpath=${R_SHARE_DIR}/java
>> ls $tools_classpath
>> ## getsp.class README
>
>> $JAVA -classpath ${tools_classpath} getsp -test
>> ## Test1234OK
>
> NB: the variable R_SHARE_DIR is set in the `which R` script.
>
> Good luck!
>
> Sebastian
>
>
> Am 22.01.19 um 14:45 schrieb Chris Evans:
>> Thanks Dirk and Enrico,
>>
>> First clarification: I'm in this mess because I'm trying to run R 3.5.2 within
>> Debian stable (9/"sretch") using the stretch-cran35 repository. That uses and
>> provides r-api-35 but many of the packages depend upon r-api-3. As Johannes
>> said a day or so back, the way around this is to use install.packages() in R to
>> get the packages you want. That leads you into quite a lot of manual
>> identification of dependencies and I worked through all the ones I hit until I
>> was left with the only packages I use that I can't install sharing just one
>> dependency: they all depend on rJava and I can't install from the r-cran-rjava
>> package in the stretch-cran35 repository because that's one of the packages
>> that depends on r-api-3.
>>
>> I thought that installing the default java and jdk Debian packages and using R
>> CMD javareconf (as root) would set the right variables for
>> install.packages("rJava") to work but no go. It fails with this information:
>>
>> checking Java support in R... present:
>> interpreter : '/usr/lib/jvm/default-java/jre/bin/java'
>> archiver : '/usr/lib/jvm/default-java/bin/jar'
>> compiler : '/usr/lib/jvm/default-java/bin/javac'
>> header prep.: '/usr/lib/jvm/default-java/bin/javah'
>> cpp flags : ''
>> java libs : ''
>> configure: error: One or more Java configuration variables are not set.
>> Make sure R is configured with full Java support (including JDK). Run
>> R CMD javareconf
>> as root to add Java support to R.
>>
>> If you don't have root privileges, run
>> R CMD javareconf -e
>> to set all Java-related variables and then install rJava.
>>
>> ERROR: configuration failed for package ‘rJava’
>> * removing ‘/usr/local/lib/R/site-library/rJava’
>>
>> I think the problem may be options setting where R/rJava will look for Java so I
>> tried:
>>
>>> options(java.home="/usr/lib/jvm/java-8-openjdk-amd64/")
>>> options("java.home")
>> $java.home
>> [1] "/usr/lib/jvm/java-8-openjdk-amd64/"
>>
>> but that doesn't change things.
>>
>> As far as I can see Debian is happy with the setup of java and javac:
>>
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# java -version
>> openjdk version "1.8.0_181"
>> OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b13)
>> OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# javac -version
>> javac 1.8.0_181
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# update-alternatives --config
>> javac
>> There is only one alternative in link group javac (providing /usr/bin/javac):
>> /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
>> Nothing to configure.
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# update-alternatives --config
>> java
>> There is only one alternative in link group java (providing /usr/bin/java):
>> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
>> Nothing to configure.
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2#
>>
>> And I have the full jdk not just the headless version I can see the header
>> files:
>>
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# ls -lsart
>> /usr/lib/jvm/java-8-openjdk-amd64/include/
>> total 220
>> 80 -rw-r--r-- 1 root root 78425 Oct 22 19:05 jvmti.h
>> 8 -rw-r--r-- 1 root root 4771 Oct 22 19:05 jvmticmlr.h
>> 76 -rw-r--r-- 1 root root 74698 Oct 22 19:05 jni.h
>> 8 -rw-r--r-- 1 root root 7404 Oct 22 19:05 jdwpTransport.h
>> 12 -rw-r--r-- 1 root root 9687 Oct 22 19:05 jawt.h
>> 24 -rw-r--r-- 1 root root 21125 Oct 22 19:05 classfile_constants.h
>> 4 drwxr-xr-x 2 root root 4096 Jan 22 08:09 linux
>> 4 drwxr-xr-x 3 root root 4096 Jan 22 08:09 .
>> 4 drwxr-xr-x 8 root root 4096 Jan 22 12:55 ..
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2#
>>
>> But I can't reconfigure R for Java:
>>
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# R CMD javareconf
>> *** JAVA_HOME is not a valid path, ignoring
>> Java interpreter : /usr/lib/jvm/default-java/jre/bin/java
>> /usr/lib/R/bin/javareconf: 1: /usr/lib/R/bin/javareconf:
>> /usr/lib/jvm/default-java/jre/bin/java: not found
>>
>>
>> *** Java interpreter doesn't work properly.
>>
>> root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2#
>>
>> I hope this helps someone see something I can fix!
>>
>> Tangential question: surely I'm not rare in running R 3.5.2 on Stretch am I?
>> Other tangential question: is there anything that can be done to fix the
>> r-api-3/r-api-3.5 issue. You can see I'm no programmer or sysadmin but if
>> there is anything I can do to help ...?
>>
>> TIA all,
>>
>> Chris
>>
>>
>>
>> ----- Original Message -----
>>> From: "Dirk Eddelbuettel" <edd using debian.org>
>>> To: "Chris Evans" <chrishold using psyctc.org>
>>> Cc: "r-sig-debian" <r-sig-debian using r-project.org>
>>> Sent: Tuesday, 22 January, 2019 12:21:39
>>> Subject: Re: [R-sig-Debian] So nearly there, but can't install rJava
>>
>>> On 22 January 2019 at 10:14, Chris Evans wrote:
>>> | root using DebianAdvent:/home/chris/Downloads/gmp-6.1.2# apt-get install
>>> | openjdk-8-jdk-headless
>>> | Reading package lists... Done
>>> | Building dependency tree
>>> | Reading state information... Done
>>> | openjdk-8-jdk-headless is already the newest version (8u181-b13-2~deb9u1).
>>> | openjdk-8-jdk-headless set to manually installed.
>>> | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
>>> |
>>> | Anyone else got any ideas?
>>>
>>> Install the full-blown jdk no just headless.
>>>
>>> In the sources for rJava I have as a build-depends
>>>
>>> openjdk-10-jdk
>>>
>>> which may of course be a virtual. At some point we had more than JDK
>>> implementation. See what you can find there.
>>>
>>> Dirk
>>>
>>> --
>>> http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
>>
>
> _______________________________________________
> R-SIG-Debian mailing list
> R-SIG-Debian using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-debian
--
Chris Evans <chris using psyctc.org> Skype: chris-psyctc
Visiting Professor, University of Sheffield <chris.evans using sheffield.ac.uk>
I do some consultation work for the University of Roehampton <chris.evans using roehampton.ac.uk> and other places but this <chris using psyctc.org> remains my main Email address.
I have "semigrated" to France, see: https://www.psyctc.org/pelerinage2016/semigrating-to-france/ if you want to book to talk, I am trying to keep that to Thursdays and my diary is now available at: https://www.psyctc.org/pelerinage2016/ecwd_calendar/calendar/
Beware: French time, generally an hour ahead of UK. That page will also take you to my blog which started with earlier joys in France and Spain!
[[alternative HTML version deleted]]
More information about the R-SIG-Debian
mailing list