I've recently started using R. Each time I start R (either in the terminal or in RStudio) I get the following error,
Error: 1:17: unexpected '{'
1: f(interactive()){`
Furthermore this error prevents me from being able to install any packages as any attempt to do so returns,
Execution halted
Warning in install.packages :
installation of package ‘stringi’ had non-zero exit status
Error: 1:17: unexpected '{'
1: f(interactive()){
I've tried to google the error but I've not found any results relating to this problem. I've tried reinstalling R but the problem persists.
I'm using Linux Mint 17.2.
This is what I did to install R
sudo vim /etc/apt/sources.list
And I added the line
deb http://cran.rstudio.com/bin/linux/ubuntu precise/
Then,
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base
Any help would be really appreciated, thank you for your time.
Do you have a .Rprofile file? It looks like somebody accidentally changed if(interactive()){ to f(interactive()){
Related
After install.packages("Rmpfr") I'm getting this error
configure: error: Header file mpfr.h not found; maybe use
--with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
I typed the suggestion --with-mpfr-include=INCLUDE_PATH into the terminal w/o success.
Look here: https://github.com/cran/Rmpfr
You first have to install the dependend libraries.
sudo apt-get install libmpfr-dev
sudo su - -c "R -e \"install.packages('Rmpfr', repos='http://cran.rstudio.com/')\""
It is also a better solution to install the R-Packages from the console, not inside R, since every user on the machine will have access to the package then. Otherwise it will just be in your personal library.
I created a new ubuntu-16.04.2-desktop-amd64 machine on VM VirtualBox and I want to be able to use the R environment with Rmpi.
Both of the below approaches gives a similar error.
Updated simplified pre-build binary approach:
When Ubuntu had installed I opened a terminal and executed the following commands:
~$ sudo apt-get update
~$ sudo apt-get install openmpi-bin
~$ sudo apt-get install r-base
~$ sudo apt-get install r-cran-rmpi
~$ R
This opened the R terminal and I invoking the follow function which resulted in an error:
> library(Rmpi)
libmpi.so: cannot open shared object file: No such file or directory
Error : .onLoad failed in loadNamespace() for 'Rmpi', details:
call: fun(libname, pkgname)
error: Cannot start MPI_Init(). Exit
Error: package or namespace load failed for ‘Rmpi’
Alternative approaches that I have attempted include using a local OpenMPI installation and using the R function install.packages to install the Rmpi package (see below). These all resulted in the same error.
I have also tried using MPICH by substituting ~$ sudo apt-get install mpich as the second command in the above procedure (including using the R function for installing the package) which results in an even more onerous runtime error.
Does anyone know what I have done wrong or what I can do to resolve this installation error?
Or alternatively, have anyone been able to successfully install a VirtualBox machine with Rmpi using any Linux distro or an image with pre-installed components?
Original local installation approach:
I have followed the instructions on this blog to download OpenMPI version 2.1.0, compile and install it. However when I try to install the package in R with:
> install.packages("Rmpi", configure.args =
c("--with-Rmpi-include=/home/jormunr/openmpi/include",
"--with-Rmpi-libpath=/home/jormunr/openmpi/lib",
"--with-Rmpi-type=OPENMPI",
"--with-mpi=/home/jormunr/openmpi/"))
it gives the following error
Error: .onLoad failed in loadNamespace() for 'Rmpi', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/jormunr/R/x86_64-pc-linux-gnu-library/3.2/Rmpi/libs/Rmpi.so':
libmpi.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
I can see that the 'libmpi.so.20' file is in the /home/jormunr/openmpi/lib that I provided as one of the parameter to the installation.
[Disclaimer: I am not a Linux expert and merely have user level skills. Any contributions or corrections from an expert will be greatly appreciated.]
Pre-build Binary Approach
Although trying various ways to install the prebuilt binaries I did not manage to get this option to work. This involved executing in the terminal the command 'sudo apt-get install r-cran-rmpi' to install the r-cran-rmpi prebuilt packages which also automatically installs the libopenmpi1.10 package that is a listed prerequisite. However, it appears that the file 'libmpi.so' is not included in the libopenmpi1.10 package but expected by the Rmpi library which causes an error in the R environment that it cannot find this file.
Local Installation Approach
The local installation did eventually succeed with a few amendments. I created a new ubuntu-16.04.2-desktop-amd64 VirtualBox image with default settings, except for 2048MB of memory and 32GB of hard drive space. When installed I opened a terminal and executed the commands from the Jovinge Lab website with the inclusion of the penultimate command which amends the run-time link editor's path and enables the install.package() function of R to find the 'libmpi.so' file. (also changed the version to 1.10.6 as this is the latest version release of version 1 – see below for version 2)
~$ cd /home/jormunr
~$ wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz
~$ tar -zxvf openmpi-1.10.6.tar.gz
~$ cd openmpi-1.10.2
~$ ./configure --prefix=/home/jormunr
~$ make
~$ make install
~$ sudo apt-get install r-base
~$ export LD_LIBRARY_PATH=/home/jormunr/lib:$LD_LIBRARY_PATH
~$ R
This opens an R terminal and I invoked the function:
> install.packages("Rmpi", configure.args =
+ c("--with-Rmpi-include=/home/jormunr/include/",
+ "--with-Rmpi-libpath=/home/jormunr/lib/",
+ "--with-Rmpi-type=OPENMPI",
+ "--with-mpi=/home/jormunr/"))
This now executed without errors and I could test it with the following R statements:
> library("Rmpi")
> mpi.spawn.Rslaves()
master (rank 0, comm. 1) of size 2 is running on: Valhalla
slave1 (rank 1, comm. 1) of size 2 is running on: Valhalla
> mpi.close.Rslaves()
[1] 1
> mpi.quit()
When I tried this process with the OpenMPI Version 2.1.0 the installation completed successfully but the above test had issues; the mpi.spawn.Rslaves() function completed but mpi.close.Rslaves() did not complete – it never returned and the terminal was left hanging.
I experienced similar challenges. I landed on this solution where libopenmpi-dev was the secret.
sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev r-base
sudo apt-get install r-cran-rmpi
sudo su
R
install.packages("doMPI", dependencies=TRUE)
I have Ubuntu 10.x OS and I have installed R on it. I want to install rJava on R. For that when I am running installed.packages("rJava) command which is giving error
checking whether Java run-time works... Error: Could not find or load main class getsp
no
configure: error: Java interpreter '/usr/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/hduser/R/i486-pc-linux-gnu-library/2.10/rJava’
The downloaded packages are in
‘/tmp/Rtmp0tlBXn/downloaded_packages’
Warning message:
In install.packages("rJava") :
installation of package 'rJava' had non-zero exit status
If I run system("java -version")
Then it showing same Java version which is given when I run Java -version command from base OS prompt. So it means no problem with Java which I can see reason in output of install package command? As suggested when I use
sudo apt-get install r-cran-rjava
Here also didnt get any luck
Please suggest
I just saw that you wrote installed.packages instead of install.packages, you have to use install.packages("rJava") to install it.
The description of the method you used (installed.packages) says: Find (or retrieve) details of all packages installed in the specified libraries.
Can you please try
install.packages("rJava")
library(rJava)
and tell me the output? (I'm pretty sure it will already work then).
in the terminal run sudo apt-get install default-jdk
then run sudo R CMD javareconf
after that you can continue in R or Rstudio install.packages("rJava")
I am trying to install the package mvoutlier but following error occurs during installation:
install.packages("mvoutlier")
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library /2.15/rgl’
ERROR: dependency ‘rgl’ is not available for package ‘compositions’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/compositions’
ERROR: dependency ‘compositions’ is not available for package ‘mvoutlier’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/mvoutlier’
After that I have install the rgl package successfully, then I tried to install the compositions package then the again same error occurs. Then I have again tried to install the mvoutlier package the same error occurs.
Can anyone let me know how I can resolve this problem. Thanking you in advance.
I suspect you are running Ubuntu 12.04.I think you're going to find that this works for the GL/gl.h problem:
install these at the regular old terminal, ie pretend R doesn't exist for now:
libglu1-mesa-dev freeglut3-dev mesa-common-dev
You might get the following error later (in R) because of a tcl b****/gripe/complaint:
Error in structure(.External(.C_dotTcl, ...), class = "tclObj") :
[tcl] can't find package BWidget.
To fix this problem, if you have it:
sudo apt-get install bwidget
These are not R problems. They are OS problems!
I ran into the same issue in between others on a Ubuntu based Linux distro (Linux Mint). Here I will share the worklog I'd done to fix it.
The full fix was:
apt-get install libx11-dev mesa-common-dev libglu1-mesa-dev
Worklog
The first error was related to missing devel libraries of X11:
configure: error: X11 not found but required, configure aborted.
I fixed it installing:
apt-get install libx11-dev
However, after fix the issue, I felt into a new one like this one:
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
I checked the library on the repository:
# dpkg -S /usr/include/GL/gl.h
dpkg-query: no path found matching pattern /usr/include/GL/gl.h
To fix this issue, install :
apt-get install mesa-common-dev
Then, I was prompt by a new error:
configure: error: missing required header GL/glu.h
To fix the issue, install the libglu1 devel libraries:
apt-get install libglu1-mesa-dev
configure: error: missing required header GL/gl.h
normally means you haven't installed the -dev version of a package, in this case GL.
On my system, GL/gl.h is owned by mesa-common-dev
$ dpkg -S /usr/include/GL/gl.h
mesa-common-dev: /usr/include/GL/gl.h
which would have been installed with apt-get install mesa-common-dev or via some GUI magic.
On Ubuntu 16.04, I solved this problem (during rgl package installation) with sudo apt-get install libglu1-mesa-dev
the current fedora package manager will fail to find these libraries as shown. Instead you need to do
sudo dnf install mesa-libGL-devel mesa-libGLU-devel
Based on the work breakdown by 3manuek, I figured only the libglu1-mesa-dev library was needed in ubuntu 16.04 LTS, and it worked.
On, RHEL, sudo yum install mesa-libGLU-devel worked.
I encountered an equivalent problem when testing a package that required 'rgl' on Travis. The problem is that the operating system lacks the necessary GL files on which the 'rgl' package draws.
A thread at R-forge offers the ingenious solution of running apt-get install r-cran-rgl, which will pull in any of the GL dependencies not already present on the operating system. This seems simpler than second-guessing which specific dependency is missing, and it remains possible to install a more recent version of 'rgl' if required.
I would like to use the R packages RNetCDF and ncdf in Ubuntu.
When I try install.packages('RNetCDF') or install.packages('ncdf'), I get similar errors:
...
ncdf.c:3:20: fatal error: netcdf.h: No such file or directory
compilation terminated.
make: *** [ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf’
...
Warning message:
In install.packages("ncdf") :
installation of package ‘ncdf’ had non-zero exit status
The packages libnetcdf6 and netcdf-bin from the Ubuntu repository are installed. Do I need to do something else?
You need to install the -dev of those packages to get the headers that are required to compile the package. In this case, you need libnetcdf-dev, udunits-bin and libudunits2-dev
In my case, libudunits2-dev package was needed.
sudo apt-get install libudunits2-dev
Since I installed NetCDF from source, I had to manually specify the locations of lib and include folders
install.packages("/home/user/Downloads/RNetCDF_1.6.1-2.tar.gz",
repos = NULL,
type="source",
dependencies=FALSE,
configure.args="--with-netcdf-include=/usr/local/netcdf-4.2.1-build/include --with-netcdf-lib=/usr/local/netcdf-4.2.1-build/lib")
Just to clarify, since your initial issue is in R, and the fix is applied outside of R. I initially was trying to do
install.packages("libnetcdf-dev"), which didn't work.
instead, from outside of R: sudo apt-get install libnetcdf-dev
That fixed it for me.
In Ubuntu 20.04 LTS one can install the ncdf4 package (which supersedes ncdf), including all dependencies, with the bash command sudo apt install r-cran-ncdf4. Similarly for RNetCDF you can use sudo apt install r-cran-rnetcdf.