5

I am having trouble loading rugarch. I can install it no problem

install.packages('rugarch')

However, when I try to load it, I get errors

library(rugarch)
Error : .onLoad failed in loadNamespace() for 'rgl', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so
  Reason: image not found
Error: package or namespace load failed for ‘rugarch’

I have tried upgrading R, reinstalling the package both to no avail. Here is my system settings:

sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.2 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] foreach_1.4.2                 blotter_0.9.1666             
[3] FinancialInstrument_1.2.0     PerformanceAnalytics_1.4.3541
[5] quantmod_0.4-5                TTR_0.23-0                   
[7] xts_0.9-7                     zoo_1.7-12                   

loaded via a namespace (and not attached):
 [1] codetools_0.2-14   lattice_0.20-33    mvtnorm_1.0-3      truncnorm_1.0-7   
 [5] grid_3.2.1         KernSmooth_2.23-15 misc3d_0.8-4       spd_2.0-1         
 [9] iterators_1.0.7    tools_3.2.1        numDeriv_2014.2-1  Rsolnp_1.15  

Any help would be appreciated. Also I have tried to download it from the cran page but that gives the same error. For what its worth, rugarch will install and load on my windows computer running 3.2.0 64-bit computer.

I tried to install an older version of rugarch from https://cran.r-project.org/src/contrib/Archive/rugarch/ but it wont even install. I tried 1.3-3, 1.3-1, and 1.2-9. This is the error I get:

gfortran-4.8: warning: couldn’t understand kern.osversion ‘14.1.0
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rugarch/libs
** R
** data
** inst
** preparing package for lazy loading
Error : .onLoad failed in loadNamespace() for 'rgl', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl/libs/rgl.so
  Reason: image not found
ERROR: lazy loading failed for package ‘rugarch’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rugarch’
Warning in install.packages :
  installation of package ‘/Downloads/rugarch_1.2-9.tar.gz’ had non-zero exit status
Bobe Kryant
  • 2,050
  • 4
  • 19
  • 32
  • I can't reproduce this on my R system. I'm running `3.1.3` with `64-bit` Windows. – Tim Biegeleisen Aug 11 '15 at 04:05
  • 1
    @TimBiegeleisen it works on my windows computer running `3.2.0`, but not on my mac for some reason. I just edited my question to reflect this – Bobe Kryant Aug 11 '15 at 04:07
  • I don't have a Linux box handy here. The only thing I can recommend is that you try using an earlier version of `rugarch`. Maybe the latest release has a bug which manifests on OSx. – Tim Biegeleisen Aug 11 '15 at 04:10
  • @TimBiegeleisen The previous versions of `rugarch` wont even install. I tried `1.3-3, 1.3-1, and 1.2-9`. I will edit my question to reflect this – Bobe Kryant Aug 11 '15 at 04:28
  • 2
    Do you have `rgl` installed? If no, you need to install `xquartz` first, then `rgl`. –  Aug 11 '15 at 04:30
  • @Pascal thank you. That worked. I had rgl, but not xquartz, please change your comment to an answer. – Bobe Kryant Aug 11 '15 at 04:43
  • Thanks to rawr: http://stackoverflow.com/questions/31820865/error-in-installing-rgl-package#comment51566864_31820865 –  Aug 11 '15 at 04:46

1 Answers1

0

Two years too late but for other people searching for a solution. The solution that worked for me

(as mentioned by user3710546 in the comments above)

is to download and install XQuartz https://www.xquartz.org

See Stackoverflow answers here and here

Greg H
  • 1,057
  • 12
  • 16