Error when install 'e1071' in R on Mac - r

Error shown on console
> install.packages('e1071')
trying URL 'https://cran.rstudio.com/src/contrib/e1071_1.6-8.tar.gz'
Content type 'application/x-gzip' length 581513 bytes (567 KB)
==================================================
downloaded 567 KB
* installing *source* package ‘e1071’ ...
** package ‘e1071’ successfully unpacked and MD5 sums checked
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... configure: error: cannot
run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.
ERROR: configuration failed for package ‘e1071’
* removing ‘/anaconda3/lib/R/library/e1071’
Warning in install.packages :
installation of package ‘e1071’ had non-zero exit status
I've checked on terminal, gcc is installed and updated.
I also tried https://cran.r-project.org/web/packages/e1071/index.html to download both latest and former versions manually and installed them on R console. The error was still there.
How can I fix it?
Thanks!

I ran into this error when using RStudio through Anaconda. I just re-downloaded RStudio from the R website, and now the error has gone away, and e1071 installs just fine.

Related

RStudio config.log file not present

I am trying install rentrez in Rstudio and it fails (error below). But I cannot find the config.log to interpret the error. Any help appreciated locating file or installing rentrez. I am doing this with R version R version 3.6.1 (2019-07-05) on Mac OS 10.14.6. Thanks
Error:
install.packages("rentrez") also installing the dependency ‘XML’
>trying URL 'https://cran.rstudio.com/src/contrib/XML_3.98-1.20.tar.gz'
>Content type 'application/x-gzip' length 1600829 bytes (1.5 MB)
downloaded 1.5 MB
>trying URL 'https://cran.rstudio.com/src/contrib/rentrez_1.2.2.tar.gz'
>Content type 'application/x-gzip' length 79029 bytes (77 KB)
downloaded 77 KB
>installing source package ‘XML’ ...
>** package ‘XML’ successfully unpacked and MD5 sums checked **
> using staged installation
> checking for gcc... x86_64-apple-darwin13.4.0-clang checking whether the C compiler works... no
>configure: error: in /private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/Rtmpp98Wvu/R.INSTALLaf61110a6db/XML':
configure: error: C compiler cannot create executables
Seeconfig.log' for more details ERROR: configuration failed for package ‘XML’
>removing ‘/opt/anaconda3/lib/R/library/XML’ Warning in install.packages : installation of package ‘XML’ had non-zero exit status ERROR: dependency ‘XML’ is not available for package ‘rentrez’
removing ‘/opt/anaconda3/lib/R/library/rentrez’ Warning in install.packages : installation of package ‘rentrez’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/RtmpxDMasm/downloaded_packages’
Updating HTML index of packages in '.Library' Making 'packages.html' ... done
I have looked for the config.log file in the working directory I am in when I enter the
install.packages("rentrez") command.
I also tried to look for it in /private/var/folders/f0/3d9kdp5j09x5xpv5t0_zq6b80000gn/T/RtmpxDMasm/downloaded_packages’, however RtmpxDMasm/downloaded_packages does not exist. Is it being deleted with the config.log file in the failed install? What should I do next?

RStudio can't install "igraph" - C compiler cannot create executables

Im using anaconda, so RStudio 1.1.456.
When I try to
install.packages("igraph")
I get this message:
trying URL 'https://cran.rstudio.com/src/contrib/igraph_1.2.4.1.tar.gz'
Content type 'application/x-gzip' length 2704004 bytes (2.6 MB)
==================================================
downloaded 2.6 MB
* installing *source* package ‘igraph’ ...
** package ‘igraph’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/x1/zlhhtxm951v95d461h7d09bc0000gn/T/Rtmp0iNakh/R.INSTALL16a5d3eb16782/igraph':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘igraph’
* removing ‘/Users/RobinHorn/anaconda3/envs/Data_Analysis/lib/R/library/igraph’
Warning in install.packages :
installation of package ‘igraph’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/x1/zlhhtxm951v95d461h7d09bc0000gn/T/RtmpYbzkOw/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
So it looks like my C compiler is not working.
What I tried already:
installing command line tools
xcode-select --install
installing missing headers:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
This results in:
installer: Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'.
gcc seems to be installed correctly:
~ % gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~ %
I ran across your post because I had the same problem. My answer hinges on one question: do you really need to access RStudio through Anaconda? If your answer is "no," then the solution is simple:
I downloaded RStudio from rstudio.com and installed it directly on my Mac; the version happens to be 1.2.5033. Now when I install
install.packages("igraph")
everything works fine. I have tested several functions with no problem (but don't forget to load the package).
Note that when I return to RStudio through Anaconda, it still does not work. Apparently, Anaconda keeps its own copy of the install tree but does not play nicely with certain packages ...

macos: configure: error: C compiler cannot create executables while install R pachage

I was facing this problem while installing R package devtools. My R studio is in Anaconda, and it's the latest version. The code is this:
install.packages("devtools")
And I got response as follows:
also installing the dependency ‘git2r’
trying URL 'https://cran.rstudio.com/src/contrib/git2r_0.21.0.tar.gz'
Content type 'application/x-gzip' length 1155512 bytes (1.1 MB)
==================================================
downloaded 1.1 MB
trying URL 'https://cran.rstudio.com/src/contrib/devtools_1.13.5.tar.gz'
Content type 'application/x-gzip' length 486555 bytes (475 KB)
==================================================
downloaded 475 KB
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-apple-darwin17.6.0
checking host system type... x86_64-apple-darwin17.6.0
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/private/var/folders/mh/df2k68vs4g3714qyztvg2y980000gn/T/RtmppuLmjL/R.INSTALL8f6b17805a/git2r':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/Users/nora/anaconda3/lib/R/library/git2r’
Warning in install.packages :
installation of package ‘git2r’ had non-zero exit status
ERROR: dependency ‘git2r’ is not available for package ‘devtools’
* removing ‘/Users/nora/anaconda3/lib/R/library/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/mh/df2k68vs4g3714qyztvg2y980000gn/T/Rtmpyjv9BV/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
To fix this problem, I've tried the following but nothing changed:
check Xcode and command line tools, and make surethe command line tools is the latest version.
update all the anaconda package.
update homebrew
update gcc
restart my laptop.
Now I've installed this package by using this code in terminal:
conda install -c r r-devtools
when I type install.packages("devtools") in my R console, nothing seems wrong and I saw feedback as following:
trying URL 'https://cran.rstudio.com/src/contrib/devtools_1.13.5.tar.gz'
Content type 'application/x-gzip' length 486555 bytes (475 KB)
==================================================
downloaded 475 KB
* installing *source* package ‘devtools’ ...
** package ‘devtools’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (devtools)
The downloaded source packages are in
‘/private/var/folders/mh/df2k68vs4g3714qyztvg2y980000gn/T/Rtmpyjv9BV/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
But I'm not sure whether I still have C compiler problem. If so, I still want to fix that for future's convenience. And still, I don't know why I countered this problem in the first place.

error installing package rweka however rjava is up to date

I am trying to install the package RWeka. I installed the java version 8, but i am keep getting this error. Can anybody help?
> install.packages('RWeka')
There is a binary version available but the source version is later:
binary source needs_compilation
RWeka 0.4-26 0.4-33 FALSE
installing the source package ‘RWeka’
trying URL 'https://cran.rstudio.com/src/contrib/RWeka_0.4-33.tar.gz'
Content type 'application/x-gzip' length 415763 bytes (406 KB)
==================================================
downloaded 406 KB
* installing *source* package ‘RWeka’ ...
** package ‘RWeka’ successfully unpacked and MD5 sums checked
Need at least Java version 1.7/7.0.
ERROR: configuration failed for package ‘RWeka’
* removing ``‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RWeka’
Warning in install.packages :
installation of package ‘RWeka’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/sh/6qsjq6gn0ysf4h1cv9nctzfr0000gn/T/RtmpCVEaSY/downloaded_packages’``
From experience, I believe there is a difference between Java and Java Offline.
Try installing the x86/x64 offline version from http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html (A handy link to keep hold of)
If you have the newest Java, just open a terminal and run
sudo R CMD javareconf
Then in a R-session,
install.packages("rJava",type='source')
install.packages("RWeka")
Ref: https://justrocketscience.com/post/install-rweka-mac

installing R gsl package on Mac

I'm trying to install the gsl package for R, which I understand is simply a wrapper around the GSL, under OSX Mavericks. I've tried the obvious:
> install.packages('gsl')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
package ‘gsl’ is available as a source package but not as a binary
Warning in install.packages :
package ‘gsl’ is not available (for R version 3.1.0)
So I ran
> install.packages('gsl',type = 'source')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/gsl_1.9-10.tar.gz'
Content type 'application/x-gzip' length 342803 bytes (334 Kb)
opened URL
==================================================
downloaded 334 Kb
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/Users/myusername/Library/R/3.1/library/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
No GSL install. D'oh! So I install GSL via Homebrew:
~ brew install gsl
==> Downloading http://ftpmirror.gnu.org/gsl/gsl-1.15.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gsl/1.15
==> make
==> make install
/usr/local/Cellar/gsl/1.15: 239 files, 6.7M, built in 101 seconds
Try to install the R package again:
> install.packages('gsl',type = 'source')
Installing package into ‘/Users/myusername/Library/R/3.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/gsl_1.9-10.tar.gz'
Content type 'application/x-gzip' length 342803 bytes (334 Kb)
opened URL
==================================================
downloaded 334 Kb
* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
checking for gsl-config... /usr/local/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.12
ERROR: configuration failed for package ‘gsl’
* removing ‘/Users/myusername/Library/R/3.1/library/gsl’
Warning in install.packages :
installation of package ‘gsl’ had non-zero exit status
I'm obviously going about this the wrong way but am unsure about where exactly the problem lies.
I was able to get things working (OS X Yosemite 10.10, R 3.1.1, gsl 1.16, gsl R package 1.9-10) with standard brew-installed R and gsl by manually prefixing CFLAGS and LDFLAGS with the output from gsl-config --cflags and gsl-config --libs respectively.
The following:
CFLAGS="-I/usr/local/opt/gsl/include" LDFLAGS="-L/usr/local/opt/gsl/lib -lgsl -lgslcblas" R
...
> install.packages("gsl")
worked for me.
Note that gsl-config lists the direct path to my Cellar, the paths above are brew symlinks.
For Mac, just run:
brew install gsl
then install the package in r
I finally got this to work though I'm not sure which parts of the following are absolutely essential. Here's a step-by-step list of instructions:
(steps in parentheses may be optional. Perhaps the whole thing works with homebrew)
(download the latest version of the GSL from http://ftp.gnu.org/gnu/gsl/ (as of this writing the file to get is gsl-1.16.tar.gz))
(open up a terminal window, untar the file, cd into the directory and then run ./configure, make and make install)
download the sources to the R package from http://cran.r-project.org/web/packages/gsl/index.html
open up a terminal window and run launchctl setenv PATH "/usr/local/bin:$PATH"
in the same terminal window, build the R package (I couldn't get this to work from within R) by untar'ing the file just downloaded, cding into the directory and then running R CMD build ./gsl and R CMD INSTALL gsl_1.9-10.tar.gz
Note to self: On Debian, to fix
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
I needed to
sudo apt-get install libgsl-dev
Note that the package name on Debian is not gsl-devel as elsewhere. Sigh.
I believe that others will find your steps successful and I think they do need to be done in that order. The build of gsl from source does need to be done after adding the homebrew default directory to the path. If you had used the binary, it was built on a CRAN machine that was able to find the (external) GSL package in the expected directy (which is not the default for homebreww installations. You might have succeeded with `install.packages('gsl_1.9-10.tar.gz', repo=NULL, type="source") if the source package were in your working directory (or add the full path/name as the first argument.) Just as with using Terminal, if you click-hold-drag a file to the R console, you will get a text entry of the full path/name.
gsl-config in included with the gsl-devel package, try installing that. After that it should work
On OS X Mavericks at least, after installing gsl via brew install gsl, the gsl-config --prefix yields /usr/local/Cellar/gsl/1.16. However, many applications/libraries like gsll for Common Lisp (in my case) expect /usr/local/Cellar/gsl/1.16/lib instead. In my case, the super lazy (long-term unacceptable) solution was just to symlink the libs from /usr/local/Cellar/gsl/1.16/lib into /usr/local/Cellar/gsl/1.16 and all was well. Hope this helps.

Resources