[R] XLConnect on Linux Mint Maya

Ista Zahn istazahn at gmail.com
Thu Jul 31 20:54:45 CEST 2014


Hi Keith,

So the plot thickens. How is it that you have R 3.1.1 but apt-get
install rJava gives you an old version of the package? This may be
potentially difficult to figure out, but you can try some easy things
first. If I were you I would start with

sudo apt-get remove r-base r-devel
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install r-base r-devel r-cran-rjava
sudo R CM D javareconf


Then restart the computer. Or something like that.

Finally, note that there is a specific mailing list for those running
R on debian (of which mint is a (n indirect) derivative): see
https://stat.ethz.ch/mailman/listinfo/r-sig-debian. You may have
better luck asking your question there.

Best,
Ista

On Thu, Jul 31, 2014 at 8:46 AM, Keith S Weintraub <kw1958 at gmail.com> wrote:
> Ista Et Al,
> Unfortunately your suggestion to use remove.packages did exactly the reverse of what you thought would happen.
>
> I have cleaned up my installation but still have trouble getting rJava to install properly and of course that means that XLConnect cannot install either.
>
> -------------------------------------
> I think this shows that the java-7-openjdk is working.
> -------------------------------------
> /home/refserv $ sudo R CMD javareconf
> Java interpreter : /usr/bin/java
> Java version     : 1.7.0_55
> Java home path   : /usr/lib/jvm/java-7-openjdk-i386/jre
> Java compiler    : /usr/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
>
> trying to compile and link a JNI progam
> detected JNI cpp flags    : -I$(JAVA_HOME)/../include
> detected JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
> gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/java-7-openjdk-i386/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
> gcc -std=gnu99 -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client -ljvm -L/usr/lib/R/lib -lR
>
>
> JAVA_HOME        : /usr/lib/jvm/java-7-openjdk-i386/jre
> Java library path: $(JAVA_HOME)/lib/i386/client
> JNI cpp flags    : -I$(JAVA_HOME)/../include
> JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
> Updating Java configuration in /usr/lib/R
> Done.
> ___________________________________
>
>
> -------------------------------------
> Purge and re-install rjava
> -------------------------------------
> /home/refserv $ sudo apt-get --purge remove r-cran-rjava
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following packages will be REMOVED:
>   r-cran-rjava*
> 0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
> After this operation, 1,651 kB disk space will be freed.
> Do you want to continue [Y/n]? y
> (Reading database ... 173764 files and directories currently installed.)
> Removing r-cran-rjava ...
>
> /home/refserv $ sudo apt-get install r-cran-rjava
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following NEW packages will be installed:
>   r-cran-rjava
> 0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
> Need to get 0 B/557 kB of archives.
> After this operation, 1,651 kB of additional disk space will be used.
> Selecting previously unselected package r-cran-rjava.
> (Reading database ... 173625 files and directories currently installed.)
> Unpacking r-cran-rjava (from .../r-cran-rjava_0.9-3-1_i386.deb) ...
> Setting up r-cran-rjava (0.9-3-1) ...
> -------------------------------------
> -------------------------------------
>
>
>
> -------------------------------------
> Here I try to install rJava in R
> but it looks like there is a version problem.
>
> Given I am using openjdk above I am not sure why R is looking at the oracle Java
> -------------------------------------
>
> home/refserv $ R
>
> R version 3.1.1 (2014-07-10) -- "Sock it to Me"
> Copyright (C) 2014 The R Foundation for Statistical Computing
> Platform: i686-pc-linux-gnu (32-bit)
>
> ........................................ (just cutting down on the output)
>
>> require(rJava)
> Loading required package: rJava
> Failed with error:  ‘package ‘rJava’ was built before R 3.0.0: please re-install it’
>> install.packages("rJava")
> Installing package into ‘/home/refserv/R/i686-pc-linux-gnu-library/3.1’
> (as ‘lib’ is unspecified)
> --- Please select a CRAN mirror for use in this session ---
> trying URL 'http://cran.mirrors.hoobly.com/src/contrib/rJava_0.9-6.tar.gz'
> Content type 'application/x-gzip' length 567515 bytes (554 Kb)
> opened URL
> ==================================================
> downloaded 554 Kb
>
>
> ........................................ (just cutting down on the output)
>
>
> checking Java support in R... present:
> interpreter : '/usr/lib/jvm/java-7-oracle/jre/bin/java'
> archiver    : '/usr/lib/jvm/java-7-oracle/bin/jar'
> compiler    : '/usr/lib/jvm/java-7-oracle/bin/javac'
> header prep.: '/usr/lib/jvm/java-7-oracle/bin/javah'
> cpp flags   : '-I/usr/lib/jvm/java-7-oracle/include -I/usr/lib/jvm/java-7-oracle/include/linux'
> java libs   : '-L/usr/lib/jvm/java-7-oracle/jre/lib/i386/client -ljvm'
> checking whether Java run-time works... ./configure: line 3729: /usr/lib/jvm/java-7-oracle/jre/bin/java: No such file or directory
> no
> configure: error: Java interpreter '/usr/lib/jvm/java-7-oracle/jre/bin/java' does not work
> ERROR: configuration failed for package ‘rJava’
> * removing ‘/home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava’
>
> The downloaded source packages are in
>         ‘/tmp/RtmpwvY4Md/downloaded_packages’
> Warning message:
> In install.packages("rJava") :
>   installation of package ‘rJava’ had non-zero exit status
>
> -------------------------------------
> -------------------------------------
>
> Thanks again for your time,
> Best,
> KW
>
>
> --
>
> On Jul 29, 2014, at 2:22 PM, Ista Zahn <istazahn at gmail.com> wrote:
>
>> On Tue, Jul 29, 2014 at 12:54 PM, Jeff Newmiller
>> <jdnewmil at dcn.davis.ca.us> wrote:
>>> Sounds to me like a problem outside of R (off topic here).
>>
>> Possibly, but I suspect that the OP now has two versions of XLConnect
>> installed, one in the user R library and one in the system-wide R
>> library.
>>
>> Keith, try
>>
>> remove.packages("XLConnect")
>> remove.packages("rJava")
>>
>> WITHOUT sudo. Then restart R; you should now get the (working)
>> system-wide versions of rJava and XLConnect.
>>
>> HTH,
>> Ista
>>
>> In particular, it doesn't sound like you are using the appropriate
>> tools (apt-get package manager for R and a JDK; R install.package()
>> for your R packages) to admin your machine. The only thing you should
>> need sudo for is to run apt-get... everything else should be done as a
>> normal user unless you really know what you are doing. I had no
>> problem installing it just now on my Ubuntu machine with OpenJDK. I
>> have no experience with Mint but Google tells me you should be able to
>> use the instructions for Ubuntu... I would expect Google to tell you
>> the same thing if you ask nicely... your most challenging task at this
>> point should be cleaning up the mess you have made by excessive use of
>> sudo ... most likely running R with it (only update your personal R
>> library directories so you are not tempted to go rogue) but you don't
>> say how you installed the jdk so that could also be messed up.
>>> ---------------------------------------------------------------------------
>>> Jeff Newmiller                        The     .....       .....  Go Live...
>>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>>>                                      Live:   OO#.. Dead: OO#..  Playing
>>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>>> ---------------------------------------------------------------------------
>>> Sent from my phone. Please excuse my brevity.
>>>
>>> On July 29, 2014 8:19:33 AM PDT, Keith S Weintraub <kw1958 at gmail.com> wrote:
>>>> John Et Al.
>>>>
>>>> I can get rJava and XLConnect to work only if I run as super user.
>>>>
>>>> Note that I have built rJava and XLConnect as super user (otherwise
>>>> neither package works).
>>>>
>>>>
>>>> ____________________________________________
>>>> Without sudo
>>>>
>>>>> require(XLConnect)
>>>> Loading required package: XLConnect
>>>> Error : .onLoad failed in loadNamespace() for 'rJava', details:
>>>> call: dyn.load(file, DLLpath = DLLpath, ...)
>>>> error: unable to load shared object
>>>> '/home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava/libs/rJava.so':
>>>> libjvm.so: cannot open shared object file: No such file or directory
>>>> _____________________________________________
>>>> With sudo
>>>>
>>>>> require(XLConnect)
>>>> Loading required package: XLConnect
>>>> XLConnect 0.2-7 by Mirai Solutions GmbH
>>>> http://www.mirai-solutions.com ,
>>>> http://miraisolutions.wordpress.com
>>>>
>>>> ______________________________________________
>>>> Note that I have changed the ownership (recursively) for rJava and
>>>> XLConnect because they were previously owned by root. Also note that
>>>> ggplot2 (included for comparison) was installed the usual way with no
>>>> problem.
>>>>
>>>> drwxr-xr-x 11 refserv refserv 4096 Jul 24 14:07 ggplot2/
>>>> drwxr-xr-x 10 refserv refserv 4096 Jul 29 08:28 rJava/
>>>> drwxr-xr-x 11 refserv refserv 4096 Jul 29 10:09 XLConnect/
>>>>
>>>> ________________________________________________
>>>>
>>>> Despite "no such file or directory" above:
>>>>
>>>> /home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava $ ls -altr
>>>> /home/refserv/>
>>>> -rwxr-xr-x 1 refserv refserv 273489 Jul 29 08:28
>>>> /home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava/libs/rJava.so
>>>>
>>>> The file rJava.so exists.
>>>>
>>>> Thanks so much for your time and help,
>>>> Best,
>>>> KW
>>>>
>>>> --
>>>>
>>>> On Jul 24, 2014, at 11:16 PM, John McKown
>>>> <john.archie.mckown at gmail.com> wrote:
>>>>
>>>>> On Thu, Jul 24, 2014 at 8:36 PM, Keith S Weintraub <kw1958 at gmail.com>
>>>> wrote:
>>>>>> Folks,
>>>>>>
>>>>>> I have been trying to get XLConnect to work on my Linux Mint Maya
>>>> machine.
>>>>>>
>>>>>> R works fine but this package doesn't seem to want to build. Here is
>>>> the message I get after supposedly building XLConnect and rJava:
>>>>>>
>>>>>>
>>>>>>>> require(XLConnect)
>>>>>>> Loading required package: XLConnect
>>>>>>> Error : .onLoad failed in loadNamespace() for 'rJava', details:
>>>>>>> call: dyn.load(file, DLLpath = DLLpath, ...)
>>>>>>> error: unable to load shared object
>>>> '/home/refserv/R/i686-pc-linux-gnu-library/3.1/rJava/libs/rJava.so':
>>>>>>> libjvm.so: cannot open shared object file: No such file or
>>>> directory
>>>>>>
>>>>>>
>>>>>> I purged the openJDK and downloaded the 1.7.0_65 JDK form Oracle.
>>>>>>
>>>>>> The build and the compile seemed to work ok as there were no errors.
>>>> For example I can generate ggplot2 graphs.
>>>>>>
>>>>>> I know this is probably the wrong forum but if someone could gently
>>>> point me in the right direction I would be very appreciative.
>>>>>>
>>>>>> Thanks so much for your time,
>>>>>> KW
>>>>>
>>>>> It works fine for me on Fedora 20 (and 19 before it). When I
>>>> installed
>>>>> R, it installed into /usr/lib64/R. There exists a file:
>>>>> /usr/lib64/R/etc/ldpaths which is executed by the R executable
>>>> script.
>>>>> This sets up the LD_LIBRARY_PATH to point to the Java installation on
>>>>> my machine. In the /usr/lib64/R/bin directory, there is a program
>>>>> called "javareconf". I would suggest that you run this with the -n
>>>>> switch, like:
>>>>>
>>>>> R CMD /usr/lib64/R/bin/javareconf -n
>>>>>
>>>>> This will show you what it _would_ do if you left off the "-n". Make
>>>>> sure it looks reasonable. If it does, then run the same command,
>>>>> without the "-n", as the "root" superuser. In my case, that would be:
>>>>>
>>>>> sudo R CMD /usr/lib64/R/bin/javareconf
>>>>>
>>>>> You need to be "root" because it update the file
>>>>> /usr/lib64/R/etc/ldpaths . I am fairly sure this will fix your
>>>>> problem.
>>>>>
>>>>> ===
>>>>>
>>>>> As a possible alternative to XLConnect, have you looked at openxlsx?
>>>>> It appears to have the same abilities, just some different syntax. It
>>>>> says that it is written in C and so should be faster than XLConnect.
>>>> I
>>>>> have tested both packages, a little, and they both seem to work well.
>>>>>
>>>>> Well, it's 22:14 hours here and I wish that I could fall asleep.
>>>> We're
>>>>> having problems at work and I know that the "big boss" will blame us
>>>>> peons if the hardware isn't fixed promptly Despite the fact that we
>>>>> are only software people and aren't allowed to touch the hardware.
>>>> Our
>>>>> management's minds are not using the same logic as mine does.
>>>>> Frustrating.
>>>>>
>>>>> --
>>>>> There is nothing more pleasant than traveling and meeting new people!
>>>>> Genghis Khan
>>>>>
>>>>> Maranatha! <><
>>>>> John McKown
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list