Unable to install package - gfortran not found

I encountered an error when installing the randomForest package on R.

R Version: 3.6.0
Error Message: gfortran -fpic -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -c rfsub.f -o rfsub.o

make: gfortran: Command not found

/usr/lib64/R/etc/Makeconf:190: recipe for target 'rfsub.o' failed

make: *** [rfsub.o] Error 127

ERROR: compilation failed for package ‘randomForest’

* removing ‘/app/R/x86_64-suse-linux-gnu-library/3.6/randomForest’

The downloaded source packages are in


Warning message:

In install.packages("randomForest") :

  installation of package ‘randomForest’ had non-zero exit status
1 Like

I'm not super familiar with what libraries look like on SUSE, but this probably means you need to do something like:

zypper install gfortran

gfortran is a system dependency that you seem to be missing. I think it's usually necessary for R, though, so surprising that you're missing it!

1 Like

Hi Cole,

Thanks for your reply.

I've noticed that there are a few variations of gfortran like gcc48-gfortran, libdfortran3, libgfortran4, etc. Do I install all of these packages?


1 Like

You probably just need the basic gfortran, I would guess. I would try just the one and see if that resolves :smile: On an Ubuntu server where I did a sanity check, there were about 600 different libraries that matched a search for "gfortran." I definitely don't think you need to (or want to) go through that whole list :smile:

1 Like