2

I have been trying a lot of different ways to install this package such as:

  • using dependencies argument
  • installing from binary zip file

But I keep getting the following error:

* installing *source* package ‘gam’ ...
** package ‘gam’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran  -fPIC  -Wall -g -O2  -c backfit.f -o backfit.o
make: gfortran: No such file or directory
make: *** [backfit.o] Error 1
ERROR: compilation failed for package ‘gam’
* removing ‘/Users/username/Library/R/3.6/library/gam’
* restoring previous ‘/Users/username/Library/R/3.6/library/gam’
Warning in install.packages :
  installation of package ‘gam’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/78/90s7m_qn425994767scnt9nh0000gn/T/RtmpvWmhBQ/downloaded_packages’
Sally_ar
  • 126
  • 8
  • `gfortran: No such file or directory` is pretty clear. If you are on windows, make sure you have Rtools35 installed and visible to R. – r2evans Aug 28 '20 at 19:54
  • Please read https://cran.r-project.org/bin/windows/Rtools/history.html ... and if you happen to go to https://cloud.r-project.org/bin/windows/Rtools/ *first*, please heed the part that says *"This documentation is about rtools40, the current version used for R 4.0.0 and newer"*, then pointing you to my first link. – r2evans Aug 28 '20 at 19:57
  • Forgot to add I am a MacOs user – Sally_ar Aug 28 '20 at 20:00
  • 3
    It looks like you are trying to build from source which probably isn't necessary. Try `install.packages("gam", type="binary")` – MrFlick Aug 28 '20 at 20:01
  • 1
    Probably a dupe of: https://stackoverflow.com/q/23916219/3358272. (Yes, that's relevant, you can disregard all mention of Rtools.) – r2evans Aug 28 '20 at 20:02
  • 1
    Thanks r2evans, I think you are right let me check. – Sally_ar Aug 28 '20 at 20:03
  • 1
    @MrFlick YES!! Your solution worked. Thank you. – Sally_ar Aug 28 '20 at 20:55
  • Sally_ar, that doesn't fix the problem that your system doesn't have `gfortran` available. If you find a package you need is not available in binary format (hard to imagine, but ...), then remember this discussion. The answer is often something like `brew install gfortran` or similar ... I don't have macos so offer that just as a flavor of something to look for. You might also want to guarantee having `gcc`/`g++` available, not sure given the output above. – r2evans Aug 28 '20 at 21:29
  • 1
    @r2evans thanks I actually did update the homebrew for my mac just as I followed the instruction by MrFlick I don't know if it was the combination or just the correct argument, it worked. I feel like this happens every time Apple iOS updates. I will make sure to follow a more reproducible path next time to make sure I understand which was the contributing factor to resolution. – Sally_ar Aug 29 '20 at 15:03

0 Answers0