Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in installation of R package #602

Open
MPagel opened this issue Nov 15, 2023 · 0 comments
Open

Error in installation of R package #602

MPagel opened this issue Nov 15, 2023 · 0 comments

Comments

@MPagel
Copy link

MPagel commented Nov 15, 2023

Problem:

After installation of the github repo I was unable to immediately run listSupportedDialects, getting a "no package" error. In my case, the package "cli" needed to be updated, which is "impossible" within the R environment alone.

Solution:

> unloadNamespace('cli')

Then with R session still running, navigate to your user's library directory, which you can find by reading the output of

> library()
or in R Studio
> .rs.defaultUserLibraryPath()

rename the "cli" folder to e.g. "cli_backup" or delete it

reinstall cli (to the latest version)
> install.packages("cli")

then re-run
> devtools::install_github("OHDSI/CommonDataModel")

details below the bump

After installing the github repo via the suggested devtools mechanism, I ran

> CommonDataModel::listSupportedDialects()
Error in loadNamespace(x) : there is no package called ‘CommonDataModel’
> library(CommonDataModel) # same error using single or double quotes
Error in library(CommonDataModel) : 
  there is no package called ‘CommonDataModel’
> devtools::install_github("OHDSI/CommonDataModel") # trying again
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘cli’ 3.2.0 is already loaded, but >= 3.3.0 is required
> install.packages("cli")
Installing package into ‘C:/Users/mpagel/OneDrive - Emory University/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.6.1.zip'
Content type 'application/zip' length 1388241 bytes (1.3 MB)
downloaded 1.3 MB

package ‘cli’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot remove prior installation of package ‘cli’
Warning in install.packages :
  problem copying C:\Users\mpagel\OneDrive - Emory University\Documents\R\win-library\4.1\00LOCK\cli\libs\x64\cli.dll to C:\Users\mpagel\OneDrive - Emory University\Documents\R\win-library\4.1\cli\libs\x64\cli.dll: Permission denied
Warning in install.packages :
  restored ‘cli’

The downloaded binary packages are in
	C:\Users\mpagel\AppData\Local\Temp\RtmpcZjM6W\downloaded_packages
> detach("package:cli", unload = TRUE, character.only = TRUE)
Error in detach("package:cli", unload = TRUE, character.only = TRUE) : 
  invalid 'name' argument
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

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.1.3    cli_3.2.0         tools_4.1.3       data.table_1.14.2
> unloadNamespace('cli')

> install.packages("cli")
Installing package into ‘C:/Users/mpagel/OneDrive - Emory University/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.6.1.zip'
Content type 'application/zip' length 1388241 bytes (1.3 MB)
downloaded 1.3 MB

package ‘cli’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  cannot remove prior installation of package ‘cli’
Warning in install.packages :
  problem copying C:\Users\mpagel\OneDrive - Emory University\Documents\R\win-library\4.1\00LOCK\cli\libs\x64\cli.dll to C:\Users\mpagel\OneDrive - Emory University\Documents\R\win-library\4.1\cli\libs\x64\cli.dll: Permission denied
Warning in install.packages :
  restored ‘cli’

The downloaded binary packages are in
	C:\Users\mpagel\AppData\Local\Temp\RtmpcZjM6W\downloaded_packages

Manually re-naming cli.dll to cli.dll.bak did NOT allow me to update -- it simply tried to write from the LOCK location to the bak file. So, you either have to delete the .dll as per https://community.rstudio.com/t/how-to-update-cli-package/141134/2 or rename the package directory R\win-library\4.1\cli

then you can run

> install.packages("cli")
Installing package into ‘C:/Users/mpagel/OneDrive - Emory University/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/cli_3.6.1.zip'
Content type 'application/zip' length 1388241 bytes (1.3 MB)
downloaded 1.3 MB

package ‘cli’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\mpagel\AppData\Local\Temp\Rtmpie0j8R\downloaded_packages
> devtools::install_github("OHDSI/CommonDataModel")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant