Error : Could not find build tools necessary to build - r

I installed Xcode on my Mac, running on the El Capitan version 10.11. I need to get files from a github repository to my workspace in R, so I run the line:
devtools::install_github("Myrepository")
And this error appears:
Downloading GitHub repo Myrepository
from URL https://api.github.com/repos/Myrepository/func/zipball/master
Erreur : Could not find build tools necessary to build func
I thought the problem may come from my gcc command line tools, but when I hit
gcc -v
I have it installed:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
Any ideas?

I had the same problem when installing the forecast package from GitHub on my Mac running El Capitan. The suggested readline fix above did not work for me. I noticed that my shell wasn't seeing R (e.g. when I typed R at a shell prompt it said command not found). I also was operating as a non-admin user of my computer and I think had installed R as a non-admin user. So I downloaded R again (same version) and installed it as an admin user. (This was based on a hunch after reading about some of the finnicky issues with R and paths in El Cap) After reinstalling R as an admin user I could then open R in a terminal, and at that point
devtools::install_github("robjhyndman/forecast")
worked fine.

Related

Python: Camelot-PY (Error: GhostscriptNotFound while it is installed) for M1 MacOS

Problems using Camelot-py for PDF parsing. Cannot locate 'gs' package, although it has been installed in any imaginable way... Using M1 Monterey OS.
While GS is clearly installed (gs launches from Terminal root just fine), home-brew installation of python / Xcode, PATH variables added through 'export PATH'. Still getting the same error with Ghostscript not being installed when trying to parse a PDF table.
Any suggestions / experience on this please? One would have thought it should not be such a massive pain to resolve...
I had the same issue, which was resolved by installing camelot-py from Anaconda:
conda install -c conda-forge camelot-py

RStudio error: unable to find utility "package", not a developer tool or in PATH

Issue description:
I'm trying to install 'ggplot2' package on my R studio I'm installing on MacOs Mojave 10.14.1. Each time I'm trying to installing using either
install.packages("ggplot2", dependencies = T)
R Studio -> tools -> install packages... and type down 'ggplot2'
I have the following error appear:
sh: line 1: 1549 Abort trap: 6 /Applications/Xcode.app/Contents/Developer
error: unable to find utility "package_name", not a developer tool or in PATH
My approach to solve the issue:
I made sure that Xcode installed and updated
in R Studio, I made sure that I'm able to download contents without using secure HTTPS method
tools -> global options -> packages -> unchecked 'Use secure download method for HTTP '
none of above approaches worked for me.
How can I overcome this issue ?!
I come across the solution in Stackoverflow provided by Ivan Mir, basically you need do the following:
Check out xcode-select --print-path in your Terminal.
If it's /Applications/Xcode.app/Contents/Developer then run
sudo xcode-select --switch /Library/Developer/CommandLineTools to set xcode-select to non-Xcode Command Line Tools.
In case you don't have /Library/Developer/CommandLineTools directory, you can get them here for your current Xcode version.

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.

Running Rattle on Mac OS X 10.9 (Mavericks)

After installing Mavericks on my Mac, I'm not able to run Rattle anymore.
Because of compatibility issues between RStudio and 10.9 (http://www.r-bloggers.com/rstudio-and-os-x-10-9-mavericks/), I installed v 0.98.433 of RStudio and R 3.0.2
Tried to launch Rattle the normal way: none.
I tried in a different way:
I manually launched xQuartz to install GTK+
via R-Studio I installed RGtg2 and Cairo
Installed Rattle, launched it and I got 1 sec message from Rattle, before it disappeared, crashing R session.
I then tried going back to R 2.15.3 (using RSwitch), doing same procedure.
Rattle starts with no ricognizable character and a bunch of related error messages on the RStudio console, from Pango.
Problem is it is looking for a directory .../pango/1.6.0 that does not exist (I have /1.8.0).
Is there any one who came out with a working combination of R/RStudio/Rattle on Mavericks?
I have a course I'm going to teach on data mining next semester and I introduced Rattle as the core tool, but I need it running.
Going back to previous Mac OS is not an option, because students may have the latest version.
Any help would be highly appreciated
I believe that the problem is with the GTK2 and Cairo modules. After building a few packages from source, rattle works for me...
I have had difficulties with Cairo/GTK2 since Mountain Lion. I got crashes using Simon's binary packages for these. Note that I updated my system to Mavericks, so I have not tried this on a clean install... I also have Homebrew installed for building programs from source. I use the ATT binary installer for R (thanks, Simon) for most packages but build a few packages from source. There were some hiccups and I spent a lot of time searching with Google. Here is what I did:
One needs XCode and the Xcode command line tools installed. After you install XCode, you need to run
sudo xcode-select --install
to install the command line tools. Then install Homebrew according to directions from the web site... Install gtk+ and cairo with their dependencies with:
brew install gtk+ cairo
And wait quite a while for everything to build....
The first problem I had is that I couldn't build any R packages from source because of this error:
make: llvm-gcc-4.2: No such file or directory
Google to the rescue...
I needed to change two lines in Makeconf in /Library/Frameworks/R.framework/Resources/etc to
CC=clang
CXX=clang++
Note: the R Mac Tools page now says this should be:
CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
LDFLAGS=-L/usr/local/clang4/lib
Then download the source packages for RGtk2, Cairo, and cairoDevice. I do all the work in my ~/bld directory with:
cd ~/bld
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/Library/Frameworks/GTK+.framework/Versions/Current/Resources/lib/pkgconfig:$PKG_CONFIG_PATH
R CMD install RGtk2_2.20.25.tar.gz
R CMD install Cairo_1.5-2.tar.gz
R CMD install cairoDevice_2.19.tar.gz
Hope this helps.

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.

Resources