inconsolata missing to build R vignette - r

On ubuntu 14.04 with texlive, checking an R package, for example with devtools check() would return :
LaTeX errors found:
! LaTeX Error: File `inconsolata.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
! Emergency stop.
<read *>
l.276 ^^M
! ==> Fatal error occurred, no output PDF file produced!

Installing texlive-fonts-extra should take care of it.
You can also (though probably not recommented) tell Rd not to use inconsolata. Just change:
\DeclareOption{inconsolata}{\setboolean{Rd#use#inconsolata}{true}}
to
\DeclareOption{inconsolata}{\setboolean{Rd#use#inconsolata}{false}}
in your Rd.sty file. On my installation it is at :
/usr/share/R/share/texmf/tex/latex/Rd.sty
but a
locate Rd.sty
should find it on any system.

I'm on macOS using Homebrew and this worked for me:
# LaTeX tools like pdflatex
brew cask install basictex
# Install texlive packages needed to build R package vignettes
sudo tlmgr update --self
sudo tlmgr update --all
sudo tlmgr install titling framed inconsolata
sudo tlmgr install collection-fontsrecommended

If you are using the Travis Continuous Integration
service, your problem could be related to the CTAN
mirrors having yet to update.
The issue appears in the Travis R community forum:
might be related to the recent switch to TexLive-2019 as the LaTeX package manager seems to fail finding inconsolata in the repository.
...
It looks to me like the mirror chosen was has not updated to 2019, so I think this will resolve itself naturally when the mirrors catch up. If not I can look into it.
In the meantime, I solved it by forcing a previous version of TeXLive with a downgrade to OSX 10.12 in .travis.yml:
# macOS 10.12 version
osx_image: xcode9.2
See this Travis page for the correspondence between XCode and OSX versions and the original thread in DevOps StackExchange.

In Debian, instead of installing the huge texlive-fonts-extra package, run this at your shell:
tlmgr install inconsolata
updmap-user

I have Mac OSx and the accepted solution didn't work to me.
This was the solution in my case, to install mactex: https://tug.org/mactex/mactex-download.html

tlmgr gave me a warning about a checksum. However this worked
get inconsolata.tds.zip from https://ctan.org/pkg/inconsolata
cd /usr/share/texmf/
sudo unzip inconsolata.tds.zip
sudo mktexlsr
I have had this problem every time I upgrade R. I agree the 1.7GB texlive-fonts-extra is ridiculous for a small file, although I understand that it does give you a choice of several Klingon fonts
this is for texLive on Ubuntu

Related

Trouble loading rJava into R and RStudio [duplicate]

I recently "upgraded" from OSX Mountain Lion to Yosemite and from R 3.1.3 to 3.2. Immediately after the upgrade, when I opened R or RStudio I got a pop-up message saying that I needed to install Java 6. In addition, loading rJava or any package that depends on rJava (e.g., xlsx) caused RStudio to crash (R also crashed when I tried this by opening R.app directly).
After trying a few fixes found on Stack Overflow and elsewhere (more details below), I am at a point where loading rJava or any package that depends on rJava no longer causes R to crash, but results in the following error:
library(rJava)
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rJava/libs/rJava.so
Reason: image not found
Error: package or namespace load failed for ‘rJava’
However, if I invoke R from the command line and then load rJava or any package that depends on rJava, it seems to work (or at least I don't get any error messages).
I've tried a number of different attempted fixes, some of them a few times, and can't quite remember exactly what I did in what order (didn't realize this would be such a morass and wasn't really keeping track), but here's the gist of it:
Added the following to my .bash_profile (per this SO answer):
export JAVA_HOME="/usr/libexec/java_home -v 1.8"
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/server
Reconfigured java from the command line as follows:
sudo R CMD javareconf -n
Checked options("java.home") and discovered this was set to NULL. I tried setting it to the following (per this SO question):
options("java.home"="/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre")
Installed the latest Java Development Kit and reinstalled rJava from source (can't remember where I found that one).
At some point while trying all of these, I was able to load rJava without crashing R, but instead got the error message posted above. In addition, when I quit RStudio, it would seem to close normally, but then an "RStudio quit unexpectedly" message would pop up, indicating that the program had crashed while trying to close.
I finally decided to install Java for OS X 2014-001 (Java 6), as I seemed to be running out of options. Now, when I opened R or RStudio the "This software needs Java 6" pop-up message no longer appeared. However, I was still getting the .onLoad failed in loadNamespace() for 'rJava' error message posted above.
In reviewing some of the posts I'd already looked at, I noticed another SO answer that I'd missed before, which recommended opening RStudio with the following command line code that gives RStudio the correct path to java:
LD_LIBRARY_PATH=$(/usr/libexec/java_home)/jre/lib/server: open -a RStudio
That opened an RStudio window and I was also able to load rJava and packages that depend on it without getting an error.
Lastly, I tried running R from the command line (which I hadn't done before). It turns out that on the command line, loading rJava or any package that depends on rJava works and does not throw any errors.
So, I can now get rJava to work if I open RStudio from the command line with the code that gives RStudio the java path (as noted above). However, I'd like to find a way to fix the underlying problem, whatever it may be, so that RStudio can be opened in the usual Mac way, without needing a command line kludge. I'm also concerned that having an old version of Java installed could cause problems down the road.
Does anyone have any ideas about how to diagnose and solve this issue?
I had the same problem and went through the same steps as you. The final step to allow starting RStudio through Finder/Spotlight was to link libjvm.dylib to /usr/local/lib:
sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
-f flag is added to force overwriting existing file/link
On OSX El Capitan 10.11, the user doesn't have permission to write to /usr/lib. So instead, use the following command:
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
You can load the libjvm.dylib explictly, by run like
dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server/libjvm.dylib')
library(rJava)
On macOS High Sierra (10.13.1) and Java Version 9 you have to use a slightly different JVM path (notice the missing jre folder in the path compared to the instructions for earlier Java versions):
sudo ln -f -s $(/usr/libexec/java_home)/lib/server/libjvm.dylib /usr/local/lib
You also have to notify R about the JVM:
MY_R_VERSION=$(Rscript -e "cat(with(R.version, sprintf('%s.%s', major, substring(minor, 1, 1))))")
ln -s /usr/local/lib/libjvm.dylib /Library/Frameworks/R.framework/Versions/$MY_R_VERSION/Resources/lib/
Following command works:
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
After that, in RStudio, loading rJava works through loading of the "xlsx" package.
library("xlsx")
P.S. #1 Environment: Mac OS X El Capitan 10.11.3+ with RStudio 0.99.491+ and R 3.2.3+. (I've now tested this also on macOS Sierra (10.12) and R.3.3.1.)
P.S. #2 I find that openxlsx is much faster and doesn't rely on Java to work, so I'm now using that package. Hope that helps others.
You should be able to use the CRAN rJava, without needing to recompile rJava or do any additional steps by linking the shared library to the R frameworks library directory.
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /Library/Frameworks/R.framework/Libraries
This is how I configured it working properly on two Macs running Mac OS X El Capitan (10.11.6):
Uninstall 'rJava' by issuing the following commands in a terminal window:
Rscript -e 'remove.packages("rJava")'
sudo Rscript -e 'remove.packages("rJava")'
Download and install the Java software from Oracle: https://www.java.com/en/download/mac_download.jsp
Add the following lines to /Users/<userid>/.bashrc using your favorite editor:
# Set JAVA_HOME so rJava package can find it
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)/jre
Close and restart any terminal, R, and RStudio windows (to pick up the changes to .bashrc).
Run the following command in a Terminal window:
sudo ln -sf $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
Run the following command in a Terminal window:
sudo Rscript -e 'install.packages("rJava", repos="http://rforge.net", type="source")'
Here is the easy steps for it:
remove the rJava package: remove.packages(rJava)
close R
install latest Java on you mac
open terminal and type this command: sudo R CMD javareconf
Open R and install rJava with this command:
install.packages("rJava", dependencies=TRUE, type="source")
The image not found issue exists with a brand-new install on OSX High Sierra with the latest Java SE 10 JDK.
I was able to solve the path issue with rJava using the fix found on the rJava Github issues page: https://github.com/s-u/rJava/issues/78
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
Here what worked for me on MAC:
in your ~/.profile or ~/.bashrc add this line:
%export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
1.1 % source .profile (or % source .bashrc)
% sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
remove.packages(rJava)
remove.packages(Rweka)
From the terminal enter this command:
%sudo R CMD javareconf
install.packages("rJava", dependencies = TRUE, type = "source")
install.packages("rJava", dependencies = TRUE, type = "source")
Load your library("rJava", "RWeka")
Best of luck.
Maybe another simple answer which does not touch your filesystem:
$ install_name_tool -add_rpath /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
(Substitute jdk1.8.0_131.jdk with your JDK path.)
Check the location of libjvm.dylib file.
Try this, in my case this worked:
dyn.load('/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home/lib/server/libjvm.dylib')
library(rJava)
I went through all the troubleshooting I could find, then installed jdk-11.0.1_osx-x64_bin.dmg from: Oracle downloads
Everything worked perfectly after that.
Check the version of the library that was not loaded when you run library('rJava') and match it to the java version you need installed.
I noticed that 'rJava' is pretty strict about JDK version while loading in Rstudio. In my case (Mac OS. 10.14.6 - Mojave) I had installed jdk-13 which was tested against jdk-11.
I have linked my JDK version to a non-existent directory that was assumed to be valid by Rstudio (JDK 11):
sudo ln -sf /Library/Java/JavaVirtualMachines/jdk-13.jdk/ /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
and suprisingly it works like a charm...
BTW., there was no problem to run 'rJava' following the previous instructions in native R.
Here you can download the legacy Java version 6 for El Capitan: https://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US
After doing so, the rJava package works for me.
This line below has solved the same problem I was having with rJava package as some others in this discussion did. I'm sure there are more than one solution to this problem and I sincerely thank them all for their contributions because sometimes one line like the one below saves a lot of time from going to trash!
sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
Run the following on the command line: sudo R CMD javareconf
Several solutions above have mentioned this, but they also suggest that one remove and subsequently re-install the rJava package. I found those additional steps to be unnecessary.
You can change the reference in R by using the following command:
sudo install_name_tool -change /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk/Contents/Home/lib/server/libjvm.dylib /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so

R Notebook Creation Failed

When I go File-New File-R Notebook, it tells me to install some packages, but then it fails giving me this message:
Notebook Creation Failed:
"One of more packages required for R Notebook creation were not installed"
I'm trying to install those packages manually, but the package installation window disappears so quickly that I can't even see which ones I should install.
I googled it around, but couldn't fine any resource.
Can anyone help me with this?
Maybe at least provide a list of packages required to run R Notebook?
R notebooks are actually not created with a package named either RNotebook or notebook or anything similar but rather with the rmarkdown package, and it needs to be a current version. So the command would be:
install.packages("rmarkdown", dependencies=TRUE) # needs to be >= version 1.3
Then your pulldown menu selections should succeed in a current version of RStudio. .... at least that is if you have the system requirements listed in the CRAN webpage:
SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org
This worked for me:
Install latest version of R from cran website
Start RStudio pointing to this version of R.
On Mac set env variable as show below and start RStudio from terminal
Then "Install Package" in RStudio for "markdown" and other ppackages will work properly installing latest required packages to open notebook
➜ export RSTUDIO_WHICH_R=/usr/local/bin/R
Don't press the error message, and read whatever you can from the installation popup under it. In my case the last message was that it has problems compiling "digest". I installed "digest" manually (install.packages("digest",type = "binary")). Then it all worked.
Mac, R version 3.6, Rstudio desktop 1.2.
I had exactly the same problem. By reading the error logs, I found g++ command not found. So just installed it and it worked fine next time I've tried.
I faced the same problem. I am using the latest version of R and RStudio and all of the installed packages are up-to-date.
Now, talking about the error in installation of packages. Follow the steps below and you will have R Notebook up and running:
Run the command
install.packages("rmarkdown", dependencies=TRUE)
You will observe several messages on the console during installation. Browse through them and jot the ones where there is ERROR in installation of some other dependent package. In my case, it was 'backports'. The error message will be like this:
ERROR: compilation failed for package 'backports'
It can be different in your case but the point is to note down the name of the package that is facing compilation issues. Use an editor(npp) to save the name of the package.
Once you get the name of the package, execute the following command:
install.packages("backports", type="binary")
After successful execution of the above command, go to File drop down and select R Markdown. Go with auto installation of the rmarkdown and rprojroot packages. They will be successfully installed and you can now use R Notebook
Let us know if this solution worked for you.
I just found the answer myself so I'm posting.
I guess there was something wrong with the server.
I went into tools-global options-packages and chose different CRAN mirror, then it worked.
UPDATE YOUR VERSION OF R - that was my solution, I had the same problem.
( First two commands ensure you get the MOST RECENT version of R which I found on a Digital Ocean page)
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
$ sudo apt-get update
$ sudo apt-get install r-base
WITHOUT the first two lines I ended up with R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
WITH the first two lines I got R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
After reinstalling R Studio, the Files -> RMarkdown was able to install all those subpackages and WORK. Hurray!

R cmd check not locating texi2pdf on mac after R 3.1.3 upgrade

Does anyone have a link to clear instructions on how to install and configure the necessary latex packages to build R packages on a mac?
I have some scripts for building and checking R packages on a mac server. They seemed to work fine, but after upgrading to R 3.1.3, many of the packages started failing with
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet, :
Running 'texi2dvi' on 'networkVignette.tex' failed.
Messages:
sh: /usr/local/bin/texi2dvi: No such file or directory
Calls: <Anonymous> -> texi2pdf -> texi2dvi
Execution halted
I found a thread which seemed to suggest I need a more recent version texinfo (5.2) than what is installed by default. And apparently I've I've got the wrong version installed in the wrong location?
which texi2pdf
/sw/bin/texi2pdf
texi2pdf --version
texi2pdf (GNU Texinfo 5.1) 5234
(same version is reported when running system('texi2pdf --version') in R )
This thread gives a link to a texinfo 5.2 source collection:
http://r.789695.n4.nabble.com/R-CMD-build-looking-for-texi2dvi-in-the-wrong-place-R-devel-td4701706.html
But I'm not familiar with installing executable from a tar.gz file on a mac. The R mac help pages I found suggest installing MacTex, which I tried but that didn't seem to help.
** Update: ** additional discussion of related problems on R-SIG-mac mailing list:
https://groups.google.com/forum/#!topic/r-sig-mac/xjyuFdl5Ezk
Update:
Here is where I'm currently at:
I removed my /sw directory to uninstall fink and all of its packages (couldn't figure out how to upgrade it)
installed homebrew
brew install texinfo installs version 5.2 the package,
but generates the message This formula is keg-only, which means it was not symlinked into /usr/local and actually installs in in /usr/local/Cellar/texinfo/5.2/bin which means it is not on the path and R won't find it.
manually symlink each of the texi2pdf, texi2dvi , etc as vincent suggests (this is because R has the /usr/local/bin location as default in the tools::texi2dvi function?
edited the /etc/paths file on the system to add /usr/local/bin so that finds the brew installed 5.2 version before it finds it before the osx system supplied version 4.6 version. This may not be necessary because R has it hardcoded?
All of this gets rid of the "can't find texi* errors", and gives me a bunch of latex errors (which I don't see on unix and windows builds) so I'm still kind of stuck.
This seems very hackish, so there must be a cleaner way? But it sounds like stuff with tex and mac is very sketchy at the moment? https://tex.stackexchange.com/questions/208181/why-did-my-tex-related-gui-program-stop-working-in-mac-os-x-yosemite
This worked for me on Mavericks and on Yosemite:
ln -s /usr/bin/texi2dvi /usr/local/bin/texi2dvi
ln -s /usr/bin/texi2pdf /usr/local/bin/texi2pdf
On my Lion system both the command which texi2pdf at a Terminal/bash prompt and from a R.app GUI prompt tell me that I have that program in:
system("which texi2pdf")
#/opt/local/bin/texi2pdf
That is a location typical for MacPorts installation. I think the /usr/local/bin/ is what the binary R version "expects". I'm not really that UNIX savvy, but I think the you can modify the PATH environment variable so that R will be able to find your installation. (Whether it will be compatible I cannot say since so much detail is missing from your question.) My Tex installation is MacTex, which I got from https://www.tug.org/mactex/. I admit to having a cobbled-together system:
system("echo $PATH")
# /opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin
That gets set at the beginning of an R session because this is the first line in my .Rprofile-(invisible)file:
Sys.setenv(PATH="/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin")
I think /sw/bin/ installations signify a fink install, which I have had very little success with. Simon Urbanek suggests not using any package installers, but then leaves the rest of us UNIX weenies very little in the way of worked examples of how to install that various external packages that underpin the many interesting and oh-so-useful R packages. So I feel your pain, but I'm not running for President.
So I suppose you could try this at your R console before again attempting one of the earlier unsuccessful installs:
Sys.setenv(PATH=paste( Sys.getenv()$PATH, # should be the character string of the $PATH
"/sw/bin/", sep=":")
)
Wish I could offer guarantees, but if it breaks the only guarantee is that you get to keep all the pieces.
I ran into a similar error message using Mavericks 10.9.5 (factory configured) and R 3.1.
It turns out that I didn't have pdfLaTex. I went to this page: http://tug.org/mactex/ and downloaded the MacTex installation package. It's big (>2GB) but after I installed it, my R package build problems went away.
Hope this might be helpful to anyone else who runs into this error message.

Error message installing Cairo package in R

I want to install the Cairo package in R using:
install.packages("Cairo")
Unfortunately this doesn't work. The error message is following:
xlib-backend.c:34:74: fatal error: X11/Intrinsic.h: No such file or directory
compilation terminated.
make: *** [xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/home/magnus/R/x86_64-pc-linux-gnu-library/3.1/Cairo’
Does anybody have an answer for this problem? I couldn't find any help in the internet so far.
Many thanks in advance!
Yours,
broesel
For me (Ubuntu 15.04) installing libxt-dev solved the problem.
(I know it's mentioned in comments above, but thought it might be good to have it in answers as well)
You need the development header as the file Intrinsic.h is not found.
For the related package cairoDevice (which I maintain for Debian), I ensure the following is installed:
libgtk2.0-dev, libcairo2-dev, xvfb, xauth, xfonts-base
If you are on a different distribution these might be called something else. The key is that the Gtk and Cairo header packages also pull in other, needed, x11 packages.
libXt-devel needs to be installed in Fedora (25):
sudo dnf install libXt-devel
On a Mac, my problems were solved once I installed libxt
brew install libxt
Similar, I'm sure to https://stackoverflow.com/a/41455437/61728
Along with the packages libgtk2.0-dev, libcairo2-dev, xvfb, xfonts-base and xauth that Dirk mentioned in the above comment , I also installed libxt-dev (after Magnus' comment) after which I was able to install Cairo in R. I am using Ubuntu 16.04 LTS
I had a lot of trouble with this, for some reason this didn't work
apt-get install libx11-dev libxt-dev libgtk2.0-dev libcairo2-dev xvfb xauth xfonts-base -y
but when I ran this immediately afterwards (even though it was already installed above), then the Cairo R package installed successfully. Not exactly sure why but thought I'd put it here in case it helps someone.
apt-get install libcairo2-dev -y
I used this:
devtools::install_github("jcassiojr/BayesPeak")
then:
library("BayesPeak")
And worked.
Paulo

Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error)

I am trying to plot using Rstudio. But when I do, plot(cars) which is the basic function, I am getting an Graphics Error in R.
Here is what I have done :
> plot(cars)
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
Please guide me through.
Solution for error:
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In R Studio, navigate to Tools, Global, Graphics (top middle), set Backend to AGG*, Apply, Ok
*Depending on your system/installation, you may have other other options in the drop down. Ex. AGG, Cairo, Cairo PNG.
AGG is a package which provides graphic devices for R based on the AGG library developed by the late Maxim Shemanarev. AGG provides both higher performance and higher quality than the standard raster devices provided by grDevices. You might need to install AGG. Compatible with R Studio since v1.4.
https://ragg.r-lib.org/
Initially, I reinstalled RStudio to the newest version (1.1.442) and, following many advice also the R-base* system (getting to R 3.4.3) using aptitude in the following way:
sudo aptitude reinstall libpangocairo-1.0-0 libpango-1.0-0
sudo aptitude reinstall r-base r-base-core r-base-dev
I used aptitude because it is usually better than apt-get to disentangle intricate dependency trees. Afterwards, when no package was loaded into the environment it was working just fine but any package loading was creating a whole variety of DLL-related errors as follows.
FINAL SOLUTION (NO NEED OF REINSTALL):
The error was showing again as soon as I loaded my self-made library. The real problem is the number of open DLL. If you load too many packages or files you will get to the limit and you will have error messages between maximal number of DLLs reached... or failed to load cairo DLL (this error warning) or even lapack routines cannot be loaded. I had these three error randomly as I loaded my full-of-dependencies-homemade-library.
So I started again looking for a solution. The final one is to allow more DLL and to do so it is enough to set the environmental variable R_MAX_NUM_DLLS to a higher number (I set it to 500). In order to avoid the hassle of setting it every time you can read ?Startup documentation and consequently write R_MAX_NUM_DLLS=500 in your Renviron file R-HOME/etc/Renviron.site. In my case (Ubuntu:16.04 it was /usr/lib/R/etc/Renviron.site. This fixed smoothly the problem.
Thank goodness, I just exited Rstudio and relaunched and the problem went away
Under Ubuntu 13.10
I had the similar issue with rstudio server, tried all different suggestions no work.
Finally figured out this way:
sudo service rstudio-server stop
remove all rstudio related files (sudo find / -name "rstudio" | xargs sudo rm -r)
uninstall R: sudo apt-get remove r-base-core r-base r-base-dev
remove all R related files (sudo find / -name "R" | xargs sudo rm -r)
re-install R: sudo apt-get install r-base-core r-base r-base-dev
test R: making sure plot(cars) works in R, output a pdf file.
re-install R studio server: http://www.rstudio.com/ide/download/server
I had the same issue and found James Mao's answer helpful, but I wanted to avoid reinstalling R so that I would not have to also reinstall all of my R packages. I was able to fix the issue by reinstalling RStudio without reinstalling R, which makes sense because the error is with RStudio, not R itself. Here are the instructions:
sudo service rstudio-server stop
remove all rstudio related files (sudo find / -name "rstudio" | xargs sudo rm -r)
re-install R studio server: http://www.rstudio.com/ide/download/server
Reinstall the package ggplot2 (install.packages"ggplot2") and invoke the library. It must work then
I meet this today, reindatall Rstudio still can't solve. finally installed textshaping
install.packages('textshaping'). It's ok now
I had the following error in a CentOS:7 Docker container when running rstudio-server verify-installation:
27 Feb 2017 14:17:09 [rsession-rstudio-server] ERROR r error 4 (R code execution error) [errormsg=Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) :
error in running command
]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::<unnamed>::evaluateExpressionsUnsafe(SEXPREC*, SEXPREC*, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::<unnamed>::EvalType) /root/rstudio/src/cpp/r/RExec.cpp:159; LOGGED FROM: rstudio::core::FilePath rstudio::session::module_context::findProgram(const std::string&) /root/rstudio/src/cpp/session/SessionModuleContext.cpp:879
27 Feb 2017 14:17:09 [rsession-rstudio-server] ERROR r error 4 (R code execution error) [errormsg=Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) :
error in running command
]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::<unnamed>::evaluateExpressionsUnsafe(SEXPREC*, SEXPREC*, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::<unnamed>::EvalType) /root/rstudio/src/cpp/r/RExec.cpp:159; LOGGED FROM: rstudio::core::FilePath rstudio::session::module_context::findProgram(const std::string&) /root/rstudio/src/cpp/session/SessionModuleContext.cpp:879
I fixed it by installing which command: yum install which
I had the same error and am on Ubuntu. I did not install R through sudo apt-get install r-base but instead downloaded a specific version, unpacked it and installed it manually with:
./configure --with-readline=no --with-x=no --enable-R-shlib
make
sudo make install
I did not have cairograpghics installed, which is apparently important to build 2D graphics with R. So I installed that with:
sudo apt-get install libcairo2-dev
Or find the version for your OS here: https://www.cairographics.org/download/
I then uninstalled R again by simply going into the downloaded R folder that I had previously compiled using the above commands mentioned and typed:
sudo make uninstall
And then I configured and installed the same R version again. That did it. The uninstall and reinstall was important, just installing cairographics didnt work, you have to have it installed before using ./configure.
I had the same problem (even though I had been using the same installation for over a year without this problem).
I just needed to restart the computer and everything was good again.
:D

Resources