Install Rmpfr package in RStudio on remote server - r

I often use R / RStudio that is located on a remote server. Unfortunately, I do not have root / sudo / administrator access on this server, so any installations need to be done only in ~/.
I know that Rmpfr relies on libmpfr4 and mpfr.h. I have mpfr and gmp installed on my local folder (~/), but it seems R / RStudio only knows to look in /usr. I have tried the following command:
install.packages("Rmpfr", type = "source", configure.args = c("--with-mpfr-include=~/include", "--with-mpfr-lib=~/lib"))
and I got the following error:
In file included from Ops.c:12:0:
Rmpfr_utils.h:22:18: fatal error: mpfr.h: No such file or directory
#include <mpfr.h>
^
compilation terminated.
make: *** [Ops.o] Error 1
ERROR: compilation failed for package ‘Rmpfr’
I confirmed that mpfr.h is in the "~/include" folder and libmpfr.a is in the "~/lib" folder. I also have all of the following in my .bash_profile:
export PATH="~/mpfr-4.1.0/src/:$PATH"
export PATH="~/bin/:$PATH"
export PATH="~/gmp-6.2.1/:$PATH"
I'm pretty far out of my element with the more technical Linux / command line stuff, but I'm trying to learn and use Google / manuals as much as possible. My server runs a redhat distro. For some reason, apt-get doesn't seem to be a valid command on my server, yum requires root access that I don't have, and I can't figure out how to install homebrew for any brew solutions.
Please let me know if I need to provide any more information. Thanks in advance.

Related

Ubuntu 16.04: fatal error: X11/Xlib.h: No such file or directory

I am trying to install Rgtk2 (dependency for rattle). I am using R thru Anaconda. I am getting the following error.
In file included from Rgtk.c:7:0:
/usr/include/gtk-2.0/gdk/gdkx.h:32:10: fatal error: X11/Xlib.h: No such file or directory
#include <X11/Xlib.h>
^~~~~~~~~~~~
I tried the following workarounds as found in StackOverflow and other blogs.
Installed libx11-dev, mesa-common-dev, libglu1-mesa-dev, libxrandr-dev, libxi-dev
Tried installing RGtk2_2.20.31 from source.
Every time I am getting the same error.
anaconda has its own environment, which by default usually lacks X11 headers(e.g libx11-dev, or whatever you call it). Try "conda install -c conda-forge xorg-libx11" . It worked for me when a certain R-package threw an error "X11/Xlib.h : No such file or directory".

Building and installing JAGS locally

I'm trying to build and install JAGS on a cluster that uses GPFS as its filesystem. I'm running into problems with the configure script:
./configure --prefix=$HOME/JAGS/ --with-lapack=/cm/shared/apps/lapack/gcc/64/3.6.0/liblapack.so
Error:
configure: error: "You need to install the LAPACK library"
I'm specifying the location of the dynamic library, but the script doesn't accept that it exists on the system. What is the cause of this?
I figured out the issue. I needed to link to BLAS by using the "--with-blas" flag. The configure script does not have an error message for a missing BLAS link, it instead treats it as a missing reference to the LAPACK library.

Error in sourceCpp after installing Rtools

A month ago I installed Rtools all by default options on my personal computer and was able to write C++ functions in R ever since. Now I am trying to install Rtools on my company's computer and unable to correctly install Rtools. I believe it has something to do with the PATH or some relevant thing that I don't quite understand. Help is so needed. Below are my steps and results:
Install R-3.03 in the local drive c; successful
install.packages(c("Rcpp","installr")); successful
library(installr)
install.Rtools(). In this step there's one thing suspicious:
I only chose "Save version information to registry".
5. library(Rcpp); evalCpp("1 + 1"); and I got the following:
running command:
make -f "C:/R- 30~1.3/etc/i386/Makeconf" -f "C:/R-30~1.3/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)
Warning message:
SHLIB="sourceCpp_35432.dll" OBJECTS="file1bb831d14d68.o"' had status 127
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please download and install the appropriate version of Rtools:
http://cran.r-project.org/bin/windows/Rtools
And I did restart the computer to see if miracles can happen, but no.
Can anyone help me? Thanks!

R studio failing to use rJava lib and failing javareconf

I'm running Rstudio on its own server.
Java is installed with good java_home and bin.
R is installed. rJava is installed.
Tried to do command: library("rJava") but had issues with libjvm.so, do following Rstudio recommandation I did sudo R CMD javareconf with root.
Here is the output of my javareconf:
Java interpreter : /home/scoremd/jdk1.7.0_03/jre/bin/java
Java version : 1.7.0_03
Java home path : /home/scoremd/jdk1.7.0_03
Java compiler : /home/scoremd/jdk1.7.0_03/bin/javac
Java headers gen.: /home/scoremd/jdk1.7.0_03/bin/javah
Java archive tool: /home/scoremd/jdk1.7.0_03/bin/jar
NOTE: Your JVM has a bogus java.library.path system property!
Trying a heuristic via sun.boot.library.path to find jvm library...
Java library path: $(JAVA_HOME)/jre/lib/amd64:$(JAVA_HOME)/jre/lib/amd64/server
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64 -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
Seems there is issue with finding the java library path... but my java is working fine and R also.
I didn't receive any solution from RStudio support and community (told me to ask in SO ....).
I have rstudio-server installed on my Centos server. There are a couple of users using rstudio and we decided to upgrade R from 3.6 to 4.0.
After the upgrade :
all users were running R 4.0.
No user could install rJava using install.package('rJava'). This error always popped up
configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
Running SUDO R CMD javareconf went smoothly, and also when I opened R as root and went along and tried install.packages('rJava') it installed the package just fine. (unbeknownst to me, root ran R 3.6 and users 4.0, see solution below)
However it did not work installing the package for users in R studio server. Always stating the same "try running sudo R CMD javareconf" as if the Java path for the users was wrong.
so we tried setting the "JAVA_HOME" variable to the same path that java jdk was installed in (found by searching installed packages in yum). That did not solve it.
my solution
I saw that root was running version 3.6 of R while all users ran 4.0. This was because I had installed 4.0 in another directory.. The directory of R 4.0 happens to be found first by the users. However for the root user... it finds the path of R 3.6 first.
So I set the path to the 4.0 folder in the $PATH variable of the root user, so that would find version 4.0 before finding R 3.6
echo $PATH
export PATH="/usr/local/bin:$PATH"
echo $PATH
Then I ran R as that user and ran "R CMD javareconf", installed the packages and all users are happy and working again.
(disclaimer, I'm not a experienced linux admin, there may be a better solution for running different R versions)
It's been some time since I used rJava, and it was on Windows, but I have some notes which may help you:
Make sure that the JRI native library is in a directory listed in java.library.path
(also confirmed using Process Explorer that jri.dll is being loaded)
The R process loads up jvm.dll when you do library(rJava)
Replace jvm.dll iny my notes above with libjvm.so in your case, and jri.dll with whatever .so file is relevant to you.

Not able to Install R package "Rgraphviz" on Mac OS X Lion

I have spent a lot of time trying to solve this, but still no luck. I am trying to get Rgraphviz to work with R 2.14.1 on a Max OS X Lion
These are the steps I took in order to install and use Rgraphviz on Mac OS X Lion:
Installed graphviz via: sudo port install graphviz
Checked that the installation was successful : pkg-config --modversion libgvc
Result: 2.28.0 <- That means its OK
Under R 2.14.1
source("http://www.bioconductor.org/biocLite.R")
biocLite("Rgraphviz")
Whenever I try to use the library I get the following error
Error : .onLoad failed in loadNamespace() for 'Rgraphviz', details:
call: value[[3L]](cond)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rgraphviz/libs/i386/Rgraphviz.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rgraphviz/libs/i386/Rgraphviz.so, 6): Library not loaded: /usr/local/lib/libgvc.5.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rgraphviz/libs/i386/Rgraphviz.so
Check that (1) graphviz is installed on your system; (2) the installed version of
graphviz matches '2.26.3'; this is the version used to build this Rgraphviz
package; (3) graphviz is accessible to R, e.g., the path to the graphviz 'bin'
directory is in the system 'PATH' variable. See additional instructions in the
'README' file of the Rgraphviz 'source' distribution, available at
Some things I notice
The graphviz suggested in the "help" file is 2.26.3 and the graphviz installed by Mac Ports is 2.28.0, but as it is a newer version I don't think this makes a difference, and besides I can not find v 2.26.3
Suggestion number (3) seems to be the key, but I can't find/don't have a bin directory under graphbiz
Also when I run a locate Rgraphviz.so there are no results.
Any clue towards a solution will be much appreciated,
Thanks a lot!
Thanks for the final answer, the installation seems to work for me! (I still have to check that the package runs properly). Just a quick observation: Graphviz was installed in /usr/local on my machine so that the above command had to be entered as follows:
sudo R CMD INSTALL --configure-args='--with-graphviz=/usr/local' Rgraphviz_1.32.0.tar.gz
One more fail point. If you used Fink to install graphviz, you may still, like me, encounter separate build errors even after you use the configure arguments to point to graphviz, which now look like:
R CMD INSTALL --configure-args='--with-graphviz=/sw' Rgraphviz_1.34.0.tar.gz
The installation will fail during build errors for LL_funcs.c because it is looking for libraries that do not install unless you ALSO install graphviz-dev. You will see this:
In file included from LL_funcs.c:1:
common.h:31:17: error: gvc.h: No such file or directory
common.h:32:22: error: gvplugin.h: No such file or directory
common.h:35:20: error: gvcext.h: No such file or directory
common.h:39:20: error: gvcjob.h: No such file or directory
followed by many more build errors of course. Just be sure to
fink install graphviz-dev

Resources