1

I tried to install package copula but incurred error.

I first installed package copula, then tried:

library(copula)

and get:

Show in New WindowClear OutputExpand/Collapse Output
Error: package or namespace load failed for ‘copula’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘gsl’

Then I installed package gsl, restarted R, and tried, following this similar issue:

if(!require(pacman)) install.packages("pacman")
pacman::p_load(copula)

which didn't seem to work. I'm using macOS Big Sur OS.


Edit:

install.packages("gsl")

returned:

  There is a binary version available but the source version is later:
Warning in install.packages :
  cannot open compressed file '/Users/xxx/.rstudio-desktop/notebooks/3D993D5E-filename/1/8FD36A93A05DA0F7/c6uz0e7whq1or_t/_rs_rdf_111422764b18d.rdf', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

Update: On 18/05/21, tried

install.packages("copula")
library(copula)

and caught error below:


> install.packages("copula")
also installing the dependency ‘gsl’


  There is a binary version available but the source version is later:

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Y
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/copula_1.0-1.tgz'
Content type 'application/x-gzip' length 7335219 bytes (7.0 MB)
==================================================
downloaded 7.0 MB


The downloaded binary packages are in
    /var/folders/ll/dvpphrys0pddnjffq7zbl7vm0000gn/T//RtmpRUGsKi/downloaded_packages
installing the source package ‘gsl’

trying URL 'https://cran.rstudio.com/src/contrib/gsl_2.1-6.tar.gz'
Content type 'application/x-gzip' length 189794 bytes (185 KB)
==================================================
downloaded 185 KB

* installing *source* package ‘gsl’ ...
** package ‘gsl’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘gsl’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/gsl’
Warning in install.packages :
  installation of package ‘gsl’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/ll/dvpphrys0pddnjffq7zbl7vm0000gn/T/RtmpRUGsKi/downloaded_packages’
> library(copula)
Error: package or namespace load failed for ‘copula’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘gsl’
nilsinelabore
  • 4,143
  • 17
  • 65
  • 122
  • What error do you get with `install.packages("gsl")`? Can you please add the output of `sessionInfo()` to your post? – jared_mamrot Apr 20 '21 at 00:30
  • Hi @jared_mamrot please see question edit – nilsinelabore Apr 20 '21 at 00:32
  • 1
    Based on the error, you may need to install gsl from source before copula will install. Instructions for compiling R packages from source on macOS Big Sur: https://stackoverflow.com/a/65334247/12957340 – jared_mamrot Apr 20 '21 at 00:57
  • 1
    Hey @nilsinelabore, did you get copula installed? It might be worth trying again (`install.packages("copula")`, as there was a new release on the 19/04/2021: https://r-forge.r-project.org/R/?group_id=2140 – jared_mamrot May 04 '21 at 23:31
  • Hi @jared_mamrot, thanks for the suggestion, unfortunately it still didn't seem to work, please see question update for more details. – nilsinelabore May 18 '21 at 13:12
  • 1
    Urgh - sorry - that's frustrating. Next step would be to install gsl 'globally' i.e. using homebrew (`brew install gsl`) or downloading it and building it from source (https://www.gnu.org/software/gsl/) – jared_mamrot May 18 '21 at 22:51
  • Hi @jared_mamrot I had to install Homebrew, then used `brew install gsl` to have `copula` downloaded, thanks for your help :) – nilsinelabore Aug 20 '22 at 00:33
  • 1
    Glad you solved your problem; and only 1yr 4mo later :) – jared_mamrot Aug 21 '22 at 06:10

1 Answers1

1

Download Homebrew then run

if(!require(pacman)) install.packages("pacman")
pacman::p_load(copula)

seems working for me :)

nilsinelabore
  • 4,143
  • 17
  • 65
  • 122