Can't install ggpubr - compilation failed for

Description of issue - I'm new to R and coding, please be merciful. I'm trying to install ggpubr and installed most of the dependencies that I didn't already have, but had a problem with nloptr, which so I cannot use ggpubr and that even when I call library(ggpubr) nothing is found.

Steps taken so far -

  • I made sure I was using the most up to date version of R
  • I tried to download ggpubr directly from Github using:
# Install
if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/ggpubr")
  • I used install.packages("nloptr") by itself using install.packages("nloptr"), which generated the same error language (see below)

Stack Overflow hasn't offered any help to a similar question also using Windows (just Ubuntu and Linux answers that I can't understand).

System Information:

  • RStudio Edition: desktop
  • RStudio Version: 1.3.959
  • OS Version: Windows 10
  • R Version: 4.0.0

sessionInfo()

R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0

Error message/output

** libs

*** arch - i386
"C:/rtools40/mingw32/bin/"g++ -std=gnu++11  -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign -c dummy.cpp -o dummy.o
"C:/rtools40/mingw32/bin/"gcc  -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG       -I"/i386/include"   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_nloptr.c -o init_nloptr.o
init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
 #include "nlopt.h"
          ^~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-40~1.0/etc/i386/Makeconf:222: init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing 'C:/Users/Cara/Documents/R/win-library/4.0/nloptr'
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status

It seems your issue is with the 32 bit version, since you are using a 64bit OS Do you have a particular reason to use a 32 bit R version? If not, then uninstall the 32 bit version to avoid this problem.

This worked perfectly, thanks a million.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.