I just upgraded my Mac to Catalina and I've been having problems installing packages.
In particular I've been getting an error that suggests gfortran might be the problem.
I'm trying to install the sf package and it requires installing classInt and units.
The first batch of error messages are as follows:
** package ‘classInt’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8 -fPIC -g -O2 -c fish1.f -o fish1.o
make: gfortran-4.8: No such file or directory
make: *** [fish1.o] Error 1
ERROR: compilation failed for package ‘classInt’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/classInt’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/classInt’
Warning in install.packages :
installation of package ‘classInt’ had non-zero exit status
I'm not sure if I have other problems further along or this failure then just causes cascading problems.
Oh I have R 3.3.2 installed.
Does anyone have suggestions for how I fix this error?
Thanks
I resolved this problem by reinstalling R. Seems to have fixed it, but now moving on to another error. Thanks for the help!
Related
I'm pretty new to R, but I've used it a little bit. However, I'm running into a problem and can't figure it out, despite having read through over a dozen other resources. For reasons I won't get into, I had to update R and R Studio. However, now none of my packages will install. For example, when I try to install dplyr, this is what I get:
> install.packages("dplyr")
There is a binary version available but the source version is later:
binary source needs_compilation
dplyr 1.0.10 1.1.0 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘dplyr’
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_1.1.0.tar.gz'
Content type 'application/x-gzip' length 1068347 bytes (1.0 MB)
==================================================
downloaded 1.0 MB
* installing *source* package ‘dplyr’ ...
** package ‘dplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/usr/local/Cellar/gcc/9.2.0/bin/g++-7 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c chop.cpp -o chop.o
/bin/sh: /usr/local/Cellar/gcc/9.2.0/bin/g++-7: No such file or directory
make: *** [chop.o] Error 127
ERROR: compilation failed for package ‘dplyr’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/dplyr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/dplyr’
Warning in install.packages :
installation of package ‘dplyr’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/k7/pbrcjpr517x06fhvnkvbq0nc0000gp/T/RtmpAODLeZ/downloaded_packages’
>
From what I've seen on other questions like this, I need to reinstall the packages to a new location. However, let's assume I'm an idiot and I have no idea how to re-install them somewhere else, where to install them, or how to make R/Rstudio that is where my packages can now be found. Can someone help me figure this out?
EDIT:
I now know that the problem is that it can't find the g++-7 dictionary, but I don't know why it is trying to find the g++-7, when my terminal says it my current version (12) is g++-12. Why would R not try to download the packages to my most recent version?
(base) Liams-MacBook-Pro:~ lessig7$ brew list gcc
/usr/local/Cellar/gcc/12.2.0/bin/c++-12
/usr/local/Cellar/gcc/12.2.0/bin/cpp-12
/usr/local/Cellar/gcc/12.2.0/bin/g++-12
/usr/local/Cellar/gcc/12.2.0/bin/gcc-12
/usr/local/Cellar/gcc/12.2.0/bin/gcc-ar-12
/usr/local/Cellar/gcc/12.2.0/bin/gcc-nm-12
/usr/local/Cellar/gcc/12.2.0/bin/gcc-ranlib-12
/usr/local/Cellar/gcc/12.2.0/bin/gcov-12
/usr/local/Cellar/gcc/12.2.0/bin/gcov-dump-12
/usr/local/Cellar/gcc/12.2.0/bin/gcov-tool-12
/usr/local/Cellar/gcc/12.2.0/bin/gfortran
/usr/local/Cellar/gcc/12.2.0/bin/gfortran-12
/usr/local/Cellar/gcc/12.2.0/bin/lto-dump-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-c++-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-g++-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-gcc-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-gcc-ar-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-gcc-nm-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-gcc-ranlib-12
/usr/local/Cellar/gcc/12.2.0/bin/x86_64-apple-darwin21-gfortran-12
/usr/local/Cellar/gcc/12.2.0/include/c++/ (806 files)
/usr/local/Cellar/gcc/12.2.0/lib/gcc/ (719 files)
Once I realized R was trying to save it to an olde version, I tried to tell it to save to the new folder with the following code (just changing the version numbers to match what is on my terminal):
install.packages("dplyr", lib="/usr/local/Cellar/gcc/12.2.0/bin/c++-12/Library/Frameworks/R.framework/Resources/include")
However, that produced the following error:
install.packages("dplyr", lib="/usr/local/Cellar/gcc/12.2.0/bin/c++-12/Library/Frameworks/R.framework/Resources/include")
Warning in install.packages :
'lib = "/usr/local/Cellar/gcc/12.2.0/bin/c++-12/Library/Frameworks/R.framework/Resources/include"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)
Error in install.packages : unable to install packages
>
install.packages("dplyr", lib="/usr/local/Cellar/gcc/12.2.0/bin/c++-12/Library/Frameworks/R.framework/Resources/include")
I'd really appreciate any help. Thank you in advance.
It looks like the problem you're encountering is due to a missing version of g++.
The error message says:
/usr/local/Cellar/gcc/9.2.0/bin/g++-7: No such file or directory
This means that the g++ compiler, which is necessary for installing some R packages, is not present in the specified location /usr/local/Cellar/gcc/9.2.0/bin/g++-7.
To fix the issue, you can try installing the g++ compiler by running the following command in your terminal:
brew install gcc
After installing g++, try installing the dplyr package again in R. If you continue to face issues, you can try reinstalling the package to a different location by using the lib argument in the install.packages function, for example:
install.packages("dplyr", lib="/path/to/new/library")
Replace "/path/to/new/library" with the desired location for the installed packages.
After updating to R 4.0.0 on my Windows machine, I can't install some packages such as xml2 (the same goes for foreign and nnet). When I try to install I get this error message:
* installing *source* package 'foreign' ...
** package 'foreign' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
"c:/rtools40/mingw32/bin/"gcc -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c R_systat.c -o R_systat.o
sh: c:/rtools40/mingw32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/i386/Makeconf:222: R_systat.o] Error 127
ERROR: compilation failed for package 'foreign'
* removing 'C:/R-PKGS/win-library/3.6/foreign'
* restoring previous 'C:/R-PKGS/win-library/3.6/foreign'
Warning in install.packages :
installation of package ‘foreign’ had non-zero exit status
The main reason for installing the xml2 package is that I want to use the tidyverse package, but when I try to run library(tidyverse) I get this message:
Error: package or namespace load failed for ‘tidyverse’:
package ‘xml2’ was installed before R 4.0.0: please re-install it
So I guess that I will have to be able to solve the problem that occurs when I try to install the xml2 package as it may occur in the future when other packages will have to be updated.
Kind regards, Andrés
R 4.0 on Windows is accompanied with a new tool set rtools40 that can be installed separately. The tool set contains compilers and other programming tools to install source code packages on Windows, while the compilers are usually already available on Linux systems. The tool set can be installed from CRAN, but it is usually not necessary, if only pre-compiled "binary packages" are installed.
An additional confusion can sometimes occur if packages from different versions of R are installed in the same folder, the so-called "personal library", in Windows by default:
c:\users\<username>\R\win-library
... or another user-specified folder. After updating to a new R version, it can be a good idea to clean up older win-libraries. Make sure, that the folders do not contain valuable personal data.
I have been having an issue installing package rms. I am trying to interpret ordinal models (using the package ordinal) and plot regressions using them. For rms, I don't even get an error, just that it updates other loaded packages, loads and attaches package 'lubridate' which had already been installed, and that 'date' is masked from the base package.
For reference I had originally tried to install hmisc, which I found out was a dependency for rms. This led to an issue installing dependency gfortran. When I attempt to install gfortran, I get
package ‘gfortran’ is not available (for R version 3.5.1)
But then, when I try to install Hmisc, I get
installing the source package ‘Hmisc’
trying URL 'https://cran.rstudio.com/src/contrib/Hmisc_4.4-0.tar.gz'
Content type 'application/x-gzip' length 744545 bytes (727 KB)
==================================================
downloaded 727 KB
* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c Hmisc.c -o Hmisc.o
gfortran -fPIC -g -O2 -c cidxcn.f -o cidxcn.o
make: gfortran: No such file or directory
make: *** [cidxcn.o] Error 1
ERROR: compilation failed for package ‘Hmisc’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Hmisc’
Warning in install.packages :
installation of package ‘Hmisc’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/5l/r40ht3p511j0mbty0ptcc7zm0000gn/T/RtmpFAI0pw/downloaded_packages’
For reference, I run this on a Mac OS Catalina (10.15.4).
Alternatively, if you have any other ways to graph regressions using ordinal models please let me know! Thank you very much.
I got a similar error even though I had installed gfortran by running brew install gfortran. But I needed to add this to my ~/.Rprofile:
Sys.setenv(PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin")
I'm trying to install R: devtools, and a single dependency (ps) is failing to install, cascading into lack of dependencies. I'm using WSL Ubuntu on Windows 10, R 3.6, and the current RStudio version.
It fails in all situations (using RStudio, accessing through command prompt, starting all the above in admin mode, starting R using sudo). I've also tried turning off my firewall as suggested by other questions around similar issues. Finally, I've tried installing it to other .libPaths() locations. Other packages install just fine. I haven't tried installing from source- because I'd need devtools to do so.
Based on the error messages, the command mv does not have permission to move the installed package from its temporary install directory to the final location in my package library (but the installation utility has no trouble making directories or writing files). Anyone have any ideas why this could happen with just this single package? I'm baffled.
> install.packages('ps')
Installing package into ‘/usr/lib/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/ps_1.3.0.tar.gz'
Content type 'application/x-gzip' length 261887 bytes (255 KB)
==================================================
downloaded 255 KB
* installing *source* package ‘ps’ ...
** package ‘ps’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -g -O2 -fdebug-prefix-map=/build/r-base-VjHo9C/r-base-3.6.0=. - fstack-protector-strong -Wformat -Werror=format-security -Wdate-time - D_FORTIFY_SOURCE=2 -g -Wall px.c -o px
a bunch of other code that I am too no0b to understand
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ps.so init.o api-common.o common.o extra.o dummy.o posix.o api-posix.o linux.o api-linux.o -L/usr/lib/R/lib -lR
installing via 'install.libs.R' to /usr/lib/R/library/00LOCK-ps/00new/ps
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/usr/lib/R/library/00LOCK-ps/00new/ps' to
'/usr/lib/R/library/ps': Permission denied
ERROR: moving to final location failed
The downloaded source packages are in
‘/tmp/Rtmpm7SpMt/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("ps") :
installation of package ‘ps’ had non-zero exit status
Setting this before installing ps solved in my WSL ubuntu 18.04.2 LTS with R 3.6.0 on Windows 10 Pro. May help your case.
Sys.setenv(R_INSTALL_STAGED = FALSE)
https://developer.r-project.org/Blog/public/2019/02/14/staged-install/
“Non Zero Exit Status” R 3.6.0 "Biobase"
Try installing from terminal as super user
sudo su - -c "R -e \"install.packages('ps', repos='http://cran.rstudio.com/')\""
If that works, then you have to check permissions for your library folder.
When I tried to install vegan using install.packages("vegan") and using RStudio I am getting the following error message
* installing *source* package ‘vegan’ ...
** package ‘vegan’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -g -O2 -fstack-protector-strong -c cepin.f -o cepin.o
/bin/bash: gfortran: command not found
/usr/lib/R/etc/Makeconf:157: recipe for target 'cepin.o' failed
make: *** [cepin.o] Error 127
ERROR: compilation failed for package ‘vegan’
* removing ‘/home/stephy/R/x86_64-pc-linux-gnu-library/3.2/vegan’
Warning in install.packages :
installation of package ‘vegan’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpoFztoS/downloaded_packages’
You need to install GFortran and make sure that it is in your PATH.
You can download a binary of it for your OS from here:
https://gcc.gnu.org/wiki/GFortranBinaries
Since you're on Linux after downloading it you can install it like this:
tar -xzvf gfortran-4.5-linux-i686.tar.gz -C /
Then add it to your PATH then try installing vegan again.