Problems installing packages

I have previously not had any problems with my packages in R.
But once I started to download the packages "bnlearn", "Rgraphviz" and "gRain" I started to receive an error once I tried to install them.

I have uninstalled R and R-studio and now I get to download bnlearn but not Rgraphviz and gRain.
I got and still get the following error:
Warning in install.packages :

  • installation of package ‘/var/folders/_0/3l6342lx6kd1z0_9lhxlw1f80000gn/T//RtmpPpcRUX/downloaded_packages/gRain_1.3-0.tar.gz’ had non-zero exit status*

It was the error "had non-zero exit status" I got before and I still get.

I hope someone can help!
Thank you

BR Lasse Waern

Btw I use Mac OS if that makes any difference?

Can you post the whole error message you are getting? You are omitting the important parts.

I get the following error:

Thank you for your response, nirgrahamuk.
Unfortunately, I am still getting the same error message once I try to install the package.

So to clarify. You have xcode ?

Yes - I downloaded xcode and also tried the

xcode-select --reset

after installing.
Unfortunately, I still get the same error.
Could it be because of the package gRain?

I get the following when I try to install the package:

The last red line means: "Error in library(gRain) : There is no package with name 'gRain'"

The error here is that 'functional' dependency is not available

You first showed issues with installing the grbase and grain.
The recent error outputs you shared are grain, so, did grbase get fixed?

It's because it seems like gRain is connected with gRbase. So no none of them seems to work. I have tried to reinstall both. Downloading previous versions of both and installing them locally (using the install button) and tried to place the packages within the package-folder myself.
None of the things seems to work.

Grain depends on grbase. So it makes the most sense to focus on grbase as a first priority.
What error on installation to you see for grbase now ?

It does not seem like I get any errors in gRbase

Have you tried installing the missing dependency for gRain? Do you get any error message for that?


It seems that it actually changed something!
gRain now displays:

Would you recommend me to reinstall R to an older version then?

Check closely, you are making a typo it should be gRain not gRrain

Woops - sorry about that.
My lecturer told us that the newest version of gRain has an error and therefore we should install an older version and she provided us this code:

detach("package:gRain", unload=TRUE)

packageUrl <- ''
install.packages(packageUrl, repos=NULL, type="source", dependencies = TRUE)"

Once I try to install based on this code I get a very long error in the console:

Thank you very much for your willingness to help. We are many who are facing this issue :confused:

when it comes to understanding errors from attempted install, as a general rule, errors propogate further errors... so not much point looking at errors later in your flow.

The most important error to fix, is the first error printed out. solve, and repeat as necessary. Can you scroll up and provide that please ?


Please do not use screenshots they are difficult to read and you can't copy information from them making things harder for people trying to help you. Instead of that paste the error messages here directly as formatted code, here is how to do it:

About your issue, you are trying to install that package from source which means it is going to need compiling but you don't have the gfortran compiler installed in your system, follow the official CRAN instructions about libraries needed to compile packages on macOS systems.