1 year ago

#376415

test-img

Agus camacho

getting fortran to work with the R package NicheMapR in MAC

I need to get R to use the gfortran on a mac air book pro, in order to make use of the package NicheMapR.

Following this site's indications: https://www.r-bloggers.com/2021/03/gfortran-support-for-r-on-macos-2/

I ran the following commands in the terminal ( i am the owner and ,supposedly, the administrator), but got permission denied for creating the file

  agus@MacBook-Pro-de-agustin ~ % mkdir -p ~/.R
  agus@MacBook-Pro-de-agustin ~ % ~/.R/Makevars
  zsh: permission denied: /Users/agus/.R/Makevars

Then I tried in Rstudio:

 dir.create('/.R')
Warning message:
 In dir.create("/.R") : '/Users/agus/.R' ya existe
 file.create('/.R/Makevars')
[1] TRUE
 file.exists('/.R/Makevars')
[1] TRUE

So the file exists, but the Mac's finder search wont find any file with Makevars in the name or , anywhere in the mac (this is so frustrating). I can though, find it using the command "go" in the finder commands for the folder name. The file Makevars is actually there, is just the search bar that wont find it.

I tried to update the file, following instructions: from R the following command supposedly does it,

 writeLines("FC = usr/local/opt/gcc/bin/gfortran
 F77 = /usr/local/opt/gcc/bin/gfortran
 FLIBS = -L/usr/local/opt/gcc/lib",'~/.R/Makevars')

But it executes and nothing changes in the file.

So i changed it manually opening the file using text edit.

Then, i test everything did work installing install.packages("cluster", type = "source") it goes well

but when i try to install

  devtools::install_github('mrke/NicheMapR')

I get

 Downloading GitHub repo mrke/NicheMapR@HEAD
 ✓ checking for file ‘/private/var/folders/9d/rc00x3p91_92g0f0p55hst5r0000gn   /T/RtmpftnYNb/remotes180a5c6eb3a1/mrke-NicheMapR-deb13eb/DESCRIPTION’ ...
─ preparing ‘NicheMapR’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘NicheMapR_3.1.0.tar.gz’

installing source package ‘NicheMapR’ ...
** using staged installation
** libs
usr/local/opt/gcc/bin/gfortran -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c AACOMMONDAT.f -o AACOMMONDAT.o
make: usr/local/opt/gcc/bin/gfortran: No such file or directory
make: *** [AACOMMONDAT.o] Error 1
ERROR: compilation failed for package ‘NicheMapR’
removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/NicheMapR’
restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/NicheMapR’
Warning messages:
1: In readLines(old_path) :
incomplete final line found on '/Users/agus/.R/Makevars'
2: In readLines(old_path) :
incomplete final line found on '/Users/agus/.R/Makevars'
3: In i.p(...) :
installation of package ‘/var/folders/9d/rc00x3p91_92g0f0p55hst5r0000gn/T//RtmpftnYNb/file180a48751948/NicheMapR_3.1.0.tar.gz’ had non-zero exit status

So it did not work..what could it be?

r

fortran

0 Answers

Your Answer

Accepted video resources