OHDSI Home | Forums | Wiki | Github

Question about error in R trying to install DatabaseConnector

I’m trying to install DatabaseConnector in R using:

install.packages(“devtools”)
install.packages(“rJava”)
devtools::install_github(“OHDSI/DatabaseConnector”)

I’m getting this error. Not sure why it’s looking for a 32bit version???

Error: package or namespace load failed for ‘DatabaseConnector’:
.onLoad failed in loadNamespace() for ‘rJava’, details:
call: inDL(x, as.logical(local), as.logical(now), …)
error: unable to load shared object ‘C:/ProgramData/R/lib/rJava/libs/i386/rJava.dll’:
LoadLibrary failure: %1 is not a valid Win32 application.


Full output is below:

R version 4.1.2 (2021-11-01) – “Bird Hippie”
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type ‘license()’ or ‘licence()’ for distribution details.

R is a collaborative project with many contributors.
Type ‘contributors()’ for more information and
‘citation()’ on how to cite R or R packages in publications.

Type ‘demo()’ for some demos, ‘help()’ for on-line help, or
‘help.start()’ for an HTML browser interface to help.
Type ‘q()’ to quit R.

[Workspace loaded from ~/.RData]

install.packages(“devtools”)
Error in install.packages : Updating loaded packages

Restarting R session…

install.packages(“devtools”)
Installing package into ‘C:/ProgramData/R/lib’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/devtools_2.4.3.zip
Content type ‘application/zip’ length 424083 bytes (414 KB)
downloaded 414 KB

package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\gresh\AppData\Local\Temp\RtmpE1gC01\downloaded_packages

install.packages(“rJava”)
Installing package into ‘C:/ProgramData/R/lib’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/rJava_1.0-6.zip
Content type ‘application/zip’ length 1513770 bytes (1.4 MB)
downloaded 1.4 MB

package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\gresh\AppData\Local\Temp\RtmpE1gC01\downloaded_packages

devtools::install_github(“OHDSI/DatabaseConnector”)
Downloading GitHub repo OHDSI/DatabaseConnector@HEAD
Installing 13 packages: Rcpp, bit, progress, tidyselect, tzdb, hms, bit64, triebeard, vroom, urltools, DBI, readr, SqlRender
Installing packages into ‘C:/ProgramData/R/lib’
(as ‘lib’ is unspecified)
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/Rcpp_1.0.8.zip
Content type ‘application/zip’ length 3318070 bytes (3.2 MB)
downloaded 3.2 MB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/bit_4.0.4.zip
Content type ‘application/zip’ length 641482 bytes (626 KB)
downloaded 626 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/progress_1.2.2.zip
Content type ‘application/zip’ length 85962 bytes (83 KB)
downloaded 83 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/tidyselect_1.1.1.zip
Content type ‘application/zip’ length 204408 bytes (199 KB)
downloaded 199 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/tzdb_0.2.0.zip
Content type ‘application/zip’ length 1445306 bytes (1.4 MB)
downloaded 1.4 MB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/hms_1.1.1.zip
Content type ‘application/zip’ length 104201 bytes (101 KB)
downloaded 101 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/bit64_4.0.5.zip
Content type ‘application/zip’ length 565157 bytes (551 KB)
downloaded 551 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/triebeard_0.3.0.zip
Content type ‘application/zip’ length 950637 bytes (928 KB)
downloaded 928 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/vroom_1.5.7.zip
Content type ‘application/zip’ length 2067539 bytes (2.0 MB)
downloaded 2.0 MB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/urltools_1.7.3.zip
Content type ‘application/zip’ length 1084163 bytes (1.0 MB)
downloaded 1.0 MB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/DBI_1.1.2.zip
Content type ‘application/zip’ length 741737 bytes (724 KB)
downloaded 724 KB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/readr_2.1.2.zip
Content type ‘application/zip’ length 1818568 bytes (1.7 MB)
downloaded 1.7 MB

trying URL ‘https://cran.rstudio.com/bin/windows/contrib/4.1/SqlRender_1.8.3.zip
Content type ‘application/zip’ length 442257 bytes (431 KB)
downloaded 431 KB

package ‘Rcpp’ successfully unpacked and MD5 sums checked
package ‘bit’ successfully unpacked and MD5 sums checked
package ‘progress’ successfully unpacked and MD5 sums checked
package ‘tidyselect’ successfully unpacked and MD5 sums checked
package ‘tzdb’ successfully unpacked and MD5 sums checked
package ‘hms’ successfully unpacked and MD5 sums checked
package ‘bit64’ successfully unpacked and MD5 sums checked
package ‘triebeard’ successfully unpacked and MD5 sums checked
package ‘vroom’ successfully unpacked and MD5 sums checked
package ‘urltools’ successfully unpacked and MD5 sums checked
package ‘DBI’ successfully unpacked and MD5 sums checked
package ‘readr’ successfully unpacked and MD5 sums checked
package ‘SqlRender’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\gresh\AppData\Local\Temp\RtmpE1gC01\downloaded_packages
√ checking for file ‘C:\Users\gresh\AppData\Local\Temp\RtmpE1gC01\remotescf4c1cc234d9\OHDSI-DatabaseConnector-d23b28c/DESCRIPTION’ …

  • preparing ‘DatabaseConnector’: (869ms)
    √ checking DESCRIPTION meta-information …
  • installing the package to process help pages
  • checking for LF line-endings in source and make files and shell scripts (7.5s)
  • checking for empty or unneeded directories
  • building ‘DatabaseConnector_5.0.0.tar.gz’

Installing package into ‘C:/ProgramData/R/lib’
(as ‘lib’ is unspecified)

  • installing source package ‘DatabaseConnector’ …
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    converting help for package ‘DatabaseConnector’
    finding HTML links … done
    DatabaseConnector-package html
    DatabaseConnectorConnection-class html
    DatabaseConnectorDbiConnection-class html
    DatabaseConnectorDriver-class html
    DatabaseConnectorDriver html
    DatabaseConnectorJdbcConnection-class html
    DatabaseConnectorResult-class html
    connect html
    createConnectionDetails html
    createZipFile html
    dbAppendTable-DatabaseConnectorConnection-character-data.frame-method
    html
    finding level-2 HTML links … done

    dbClearResult-DatabaseConnectorResult-method
    html
    dbColumnInfo-DatabaseConnectorResult-method
    html
    dbConnect-DatabaseConnectorDriver-method
    html
    dbCreateTable-DatabaseConnectorConnection-character-data.frame-method
    html
    dbDisconnect-DatabaseConnectorConnection-method
    html
    dbExecute-DatabaseConnectorConnection-character-method
    html
    dbExistsTable-DatabaseConnectorConnection-character-method
    html
    dbFetch-DatabaseConnectorResult-method
    html
    dbGetQuery-DatabaseConnectorConnection-character-method
    html
    dbGetRowCount-DatabaseConnectorResult-method
    html
    dbGetRowsAffected-DatabaseConnectorResult-method
    html
    dbGetStatement-DatabaseConnectorResult-method
    html
    dbHasCompleted-DatabaseConnectorResult-method
    html
    dbIsValid-DatabaseConnectorDbiConnection-method
    html
    dbIsValid-DatabaseConnectorJdbcConnection-method
    html
    dbListFields-DatabaseConnectorConnection-character-method
    html
    dbListTables-DatabaseConnectorConnection-method
    html
    dbQuoteIdentifier-DatabaseConnectorConnection-character-method
    html
    dbQuoteString-DatabaseConnectorConnection-character-method
    html
    dbReadTable-DatabaseConnectorConnection-character-method
    html
    dbRemoveTable-DatabaseConnectorConnection-character-method
    html
    dbSendQuery-DatabaseConnectorDbiConnection-character-method
    html
    dbSendQuery-DatabaseConnectorJdbcConnection-character-method
    html
    dbSendStatement-DatabaseConnectorConnection-character-method
    html
    dbUnloadDriver-DatabaseConnectorDriver-method
    html
    dbWriteTable-DatabaseConnectorConnection-character-data.frame-method
    html
    disconnect html
    downloadJdbcDrivers html
    executeSql html
    getAvailableJavaHeapSpace html
    getTableNames html
    insertTable html
    isSqlReservedWord html
    jdbcDrivers html
    lowLevelExecuteSql html
    lowLevelQuerySql html
    lowLevelQuerySqlToAndromeda html
    querySql html
    querySqlToAndromeda html
    renderTranslateExecuteSql html
    renderTranslateQueryApplyBatched html
    renderTranslateQuerySql html
    renderTranslateQuerySqlToAndromeda html
    show-DatabaseConnectorConnection-method
    html
    show-DatabaseConnectorDriver-method html
    ** building package indices
    ** installing vignettes
    ‘UsingDatabaseConnector.Rmd’ using ‘UTF-8’
    ** testing if installed package can be loaded from temporary location
    *** arch - i386
    Error: package or namespace load failed for ‘DatabaseConnector’:
    .onLoad failed in loadNamespace() for ‘rJava’, details:
    call: inDL(x, as.logical(local), as.logical(now), …)
    error: unable to load shared object ‘C:/ProgramData/R/lib/rJava/libs/i386/rJava.dll’:
    LoadLibrary failure: %1 is not a valid Win32 application.

Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for ‘i386’

  • removing ‘C:/ProgramData/R/lib/DatabaseConnector’
    Warning message:
    In i.p(…) :
    installation of package ‘C:/Users/gresh/AppData/Local/Temp/RtmpE1gC01/filecf4c6ced4750/DatabaseConnector_5.0.0.tar.gz’ had non-zero exit status

I was able to get this to run by making the modifications shown below

install.packages("devtools")
install.packages("rJava", INSTALL_opts = "--no-multiarch")
devtools::install_github("OHDSI/DatabaseConnector", INSTALL_opts = "--no-multiarch")
devtools::install_github("OHDSI/SqlRender", INSTALL_opts = "--no-multiarch")

Using these versions:
Windows 10
Java “17.0.2” 2022-01-18 LTS
R 62bit default

I also needed to run RStudio as “admin” to get it to run correctly.

1 Like
t