Error: installation of package org.Mm.eg.db had non-zero exit status
1
0
Entering edit mode
@zhangdengwei-22186
Last seen 4.4 years ago

hi,

I am installing the package, org.Mm.eg.db, using the following command:

BiocManager::install("org.Mm.eg.db")

But I have got the warning and failed to install. My R version is 3.5.1.

Warning message:
In install.packages(...) :
  installation of package ‘org.Mm.eg.db’ had non-zero exit status

Any suggestion is appreciated. Thanks in advance.

OrgDb • 8.1k views
ADD COMMENT
0
Entering edit mode

Please show the full command. Make sure your temporary directory path does not contain Chinese characters by setting the environment variable TEMPDIR (see ?tempdir() for more help).

I have

> BiocManager::install("org.Mm.eg.db")
Bioconductor version 3.9 (BiocManager 1.30.4), R 3.6.1 Patched (2019-10-04
  r77256)
Installing package(s) 'org.Mm.eg.db'
trying URL 'https://bioconductor.org/packages/3.9/data/annotation/src/contrib/org.Mm.eg.db_3.8.2.tar.gz'
Content type 'application/x-gzip' length 71122045 bytes (67.8 MB)
==================================================
downloaded 67.8 MB

* installing *source* package 'org.Mm.eg.db' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (org.Mm.eg.db)
> 
ADD REPLY
0
Entering edit mode

Thanks. My path does not contain Chinese characters, and I attached my command as follows:

> getwd()
[1] "C:/Users/zhangdengwei/Documents"
> BiocManager::install("org.Mm.eg.db")
Bioconductor version 3.8 (BiocManager 1.30.8), ?BiocManager::install for help
Bioconductor version '3.8' is out-of-date; the current release version '3.9' is available with R version
  '3.6'; see https://bioconductor.org/install
Bioconductor version 3.8 (BiocManager 1.30.8), R 3.5.1 (2018-07-02)
Installing package(s) 'org.Mm.eg.db'
installing the source package ‘org.Mm.eg.db’

trying URL 'https://bioconductor.org/packages/3.8/data/annotation/src/contrib/org.Mm.eg.db_3.7.0.tar.gz'
Content type 'application/x-gzip' length 69822781 bytes (66.6 MB)
downloaded 66.6 MB

* installing *source* package 'org.Mm.eg.db' ...
** R
** inst
** byte-compile and prepare package for lazy loading
Error: package or namespace load failed for 'AnnotationDbi' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called 'RSQLite'
Error : package 'AnnotationDbi' could not be loaded
ERROR: lazy loading failed for package 'org.Mm.eg.db'
* removing 'C:/Users/zhangdengwei/Documents/R/win-library/3.5/org.Mm.eg.db'
In R CMD INSTALL

The downloaded source packages are in
    ‘C:\Users\zhangdengwei\AppData\Local\Temp\RtmpIDBXB0\downloaded_packages’
Installation path not writeable, unable to update packages: boot, class, cluster, codetools, foreign,
  KernSmooth, lattice, MASS, Matrix, mgcv, nlme, rpart, survival
Old packages: 'digest'
Update all/some/none? [a/s/n]: 
a

  There is a binary version available but the source version is later:
       binary source needs_compilation
digest 0.6.21 0.6.22              TRUE

  Binaries will be installed
trying URL 'https://cran.csiro.au/bin/windows/contrib/3.5/digest_0.6.21.zip'
Content type 'application/zip' length 237366 bytes (231 KB)
downloaded 231 KB

package ‘digest’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\zhangdengwei\AppData\Local\Temp\RtmpIDBXB0\downloaded_packages
Warning message:
In install.packages(...) :
  installation of package ‘org.Mm.eg.db’ had non-zero exit status
ADD REPLY
0
Entering edit mode

I finally fixed it by installing it from the local file using install.packages(). Thanks very much!

ADD REPLY
0
Entering edit mode

For help understanding what the problem is, can you provide the output of the following command?

inst <- installed.packages()
ridx <- inst[, "Package"] %in% c("RSQLite", "AnnotationDbi", "org.Mm.eg.db")
cidx <- c("Package", "LibPath", "Version")
inst[ ridx, cidx ]

Mine is

> inst[ ridx, cidx ]
              Package         LibPath                                 Version
AnnotationDbi "AnnotationDbi" "/Users/ma38727/Library/R/3.6/Bioc/3.9" "1.46.0"
org.Mm.eg.db  "org.Mm.eg.db"  "/Users/ma38727/Library/R/3.6/Bioc/3.9" "3.8.2"
RSQLite       "RSQLite"       "/Users/ma38727/Library/R/3.6/Bioc/3.9" "2.1.1"
ADD REPLY
0
Entering edit mode

Sure. Mine is

> inst <- installed.packages()
> ridx <- inst[, "Package"] %in% c("RSQLite", "AnnotationDbi", "org.Mm.eg.db")
> cidx <- c("Package", "LibPath", "Version")
> inst[ ridx, cidx ]
              Package         LibPath                                             Version 
AnnotationDbi "AnnotationDbi" "C:/Users/zhangdengwei/Documents/R/win-library/3.5" "1.44.0"
org.Mm.eg.db  "org.Mm.eg.db"  "C:/Users/zhangdengwei/Documents/R/win-library/3.5" "3.7.0" 
RSQLite       "RSQLite"       "C:/Users/zhangdengwei/Documents/R/win-library/3.5" "2.1.2"

Moreover, I found there was a lack of RSQLite when installing. So maybe it was the key point.

ADD REPLY
0
Entering edit mode

I finally fixed it by installing it from the local file using install.packages(). Thanks very much!

ADD REPLY
0
Entering edit mode

Hi I'm having the same problem but it's still not working for me when I try to install with install.packages(). I got this:

setwd('C:/Users/guruiz/Desktop')
install.packages("C:/Users/guruiz/Desktop/org.Mm.eg.db_3.8.2.tar.gz")
Installing package into ‘\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from 'pkgs'
* installing *source* package 'org.Mm.eg.db' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in findpack(package, lib.loc) : 
  there is no package called 'org.Mm.eg.db'
Calls: <Anonymous> -> findpack
Execution halted
ERROR: lazy loading failed for package 'org.Mm.eg.db'
* removing '\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs/org.Mm.eg.db'
* restoring previous '\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs/org.Mm.eg.db'
Warning message:
In install.packages("C:/Users/guruiz/Desktop/org.Mm.eg.db_3.8.2.tar.gz") :
  installation of package ‘C:/Users/guruiz/Desktop/org.Mm.eg.db_3.8.2.tar.gz’ had non-zero exit status

I have and old version of the package but I need the new one

    inst <- installed.packages()
ridx <- inst[, "Package"] %in% c("RSQLite", "AnnotationDbi", "org.Mm.eg.db")
cidx <- c("Package", "LibPath", "Version")
inst[ ridx, cidx ]
              Package         LibPath                                                        Version 
AnnotationDbi "AnnotationDbi" "\\\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs" "1.47.1"
org.Mm.eg.db  "org.Mm.eg.db"  "\\\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs" "2.7.1" 
RSQLite       "RSQLite"       "\\\\hest.nas.ethz.ch/green_users_all_homes/guruiz/R3UserLibs" "2.1.2"

Any help will be appreciated. Thanks.

ADD REPLY
0
Entering edit mode

When installing from source, install.packages() should have the repos=NULL argument provided explicitly.

I think this is a problem with the network drive \\\h... and that the work-around (I think this is addressed in R-devel...) is to use Windows to 'map network drive' (via google) and use the mapped drive to set .libPaths(). Hope that's enough of a hint...

ADD REPLY
0
Entering edit mode

Maybe you can try it again using Rstudio, Tools -> Install Packages, not type in install.packages() though the Console interface.

ADD REPLY
0
Entering edit mode
@michael-degaud-23371
Last seen 3.6 years ago

Hi,

I have the same warning (non-zero exit status) when I try to install the package org.Mm.eg.db. My R version is 3.6.3 and I'm using RStudio. My OS is windows 10. And I'm a R beginner.

The full command is :

> BiocManager::install("org.Mm.eg.db")
Bioconductor version 3.10 (BiocManager 1.30.10), R 3.6.3 (2020-02-29)
Installing package(s) 'org.Mm.eg.db'
installing the source package ‘org.Mm.eg.db’

trying URL 'https://bioconductor.org/packages/3.10/data/annotation/src/contrib/org.Mm.eg.db_3.10.0.tar.gz'
Content type 'application/x-gzip' length 72221575 bytes (68.9 MB)
downloaded 68.9 MB

* installing *source* package 'org.Mm.eg.db' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'org.Mm.eg.db'
    finding HTML links ... done
    org.Mm.egACCNUM                         html  
    org.Mm.egALIAS2EG                       html  
    org.Mm.egBASE                           html  
    org.Mm.egCHR                            html  
    org.Mm.egCHRLENGTHS                     html  
    org.Mm.egCHRLOC                         html  
    org.Mm.egENSEMBL                        html  
    org.Mm.egENSEMBLPROT                    html  
    org.Mm.egENSEMBLTRANS                   html  
    org.Mm.egENZYME                         html  
    org.Mm.egGENENAME                       html  
    org.Mm.egGO                             html  
    org.Mm.egMAPCOUNTS                      html  
    org.Mm.egMGI                            html  
    org.Mm.egORGANISM                       html  
    org.Mm.egPATH                           html  
    org.Mm.egPFAM                           html  
    org.Mm.egPMID                           html  
    org.Mm.egPROSITE                        html  
    org.Mm.egREFSEQ                         html  
    org.Mm.egSYMBOL                         html  
    org.Mm.egUNIGENE                        html  
    org.Mm.egUNIPROT                        html  
    org.Mm.eg_dbconn                        html  
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'org.Mm.eg.db':
 .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
  call: NULL
  error: Failed to load extension: Le module spécifié est introuvable.

Error: loading failed
Execution halted
*** arch - x64
Error: package or namespace load failed for 'org.Mm.eg.db':
 .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
  call: NULL
  error: Failed to load extension: Le module spécifié est introuvable.

Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Program Files/R/R-3.6.3/library/org.Mm.eg.db'

The downloaded source packages are in
    ‘C:\Users\Propriétaire\AppData\Local\Temp\RtmpQT03YD\downloaded_packages’
Old packages: 'nlme', 'survival'
Update all/some/none? [a/s/n]: 
a

  There are binary versions available but the source versions are later:
          binary  source needs_compilation
nlme     3.1-145 3.1-147              TRUE
survival  3.1-11  3.1-12              TRUE

  Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/nlme_3.1-145.zip'
Content type 'application/zip' length 2374770 bytes (2.3 MB)
downloaded 2.3 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/survival_3.1-11.zip'
Content type 'application/zip' length 7774086 bytes (7.4 MB)
downloaded 7.4 MB

package ‘nlme’ successfully unpacked and MD5 sums checked
Error in unpackPkgZip(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib, libs_only,  : 
  ERROR: failed to lock directory ‘C:\Program Files\R\R-3.6.3\library’ for modifying
Try removing ‘C:\Program Files\R\R-3.6.3\library/00LOCK’
In addition: Warning message:
In install.packages(...) :
  installation of package ‘org.Mm.eg.db’ had non-zero exit status

(I'm sorry, even if I changed language to english, there are still some part in french "Le module spécifié est introuvable" means that R can't find the module)

When I delete C:\Program Files\R\R-3.6.3\library/00LOCK, it still doesn't work.

As discussed in messages above, I tried to install the package using the RStudio tool (Tools , Install packages). I have the same error (see the next message, this one is too long, I can't past the entire R code)

ADD COMMENT
0
Entering edit mode

When I try to install the package using the RStudio tool I have the same error :

> install.packages("C:/R/Packages/org.Mm.eg.db_3.10.0.tar.gz", repos = NULL, type = "source")
    WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

    https://cran.rstudio.com/bin/windows/Rtools/
    Installing package into ‘C:/Program Files/R/R-3.6.3/library’
    (as ‘lib’ is unspecified)
    * installing *source* package 'org.Mm.eg.db' ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
      converting help for package 'org.Mm.eg.db'
        finding HTML links ... done
        org.Mm.egACCNUM                         html  
        org.Mm.egALIAS2EG                       html  
        org.Mm.egBASE                           html  
        org.Mm.egCHR                            html  
        org.Mm.egCHRLENGTHS                     html  
        org.Mm.egCHRLOC                         html  
        org.Mm.egENSEMBL                        html  
        org.Mm.egENSEMBLPROT                    html  
        org.Mm.egENSEMBLTRANS                   html  
        org.Mm.egENZYME                         html  
        org.Mm.egGENENAME                       html  
        org.Mm.egGO                             html  
        org.Mm.egMAPCOUNTS                      html  
        org.Mm.egMGI                            html  
        org.Mm.egORGANISM                       html  
        org.Mm.egPATH                           html  
        org.Mm.egPFAM                           html  
        org.Mm.egPMID                           html  
        org.Mm.egPROSITE                        html  
        org.Mm.egREFSEQ                         html  
        org.Mm.egSYMBOL                         html  
        org.Mm.egUNIGENE                        html  
        org.Mm.egUNIPROT                        html  
        org.Mm.eg_dbconn                        html  
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    *** arch - i386
    Error: package or namespace load failed for 'org.Mm.eg.db':
     .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
      call: NULL
      error: Failed to load extension: Le module spécifié est introuvable.

    Error: loading failed
    Execution halted
    *** arch - x64
    Error: package or namespace load failed for 'org.Mm.eg.db':
     .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
      call: NULL
      error: Failed to load extension: Le module spécifié est introuvable.

    Error: loading failed
    Execution halted
    ERROR: loading failed for 'i386', 'x64'
    * removing 'C:/Program Files/R/R-3.6.3/library/org.Mm.eg.db'
    Warning in install.packages :
      installation of package ‘C:/R/Packages/org.Mm.eg.db_3.10.0.tar.gz’ had non-zero exit status

I don't know how to resolve this problem. Do you have some ideas? Once again, as I'm a beginner, maybe it's just a stupid mistake...

Thanks for your help!

Michaël

ADD REPLY
0
Entering edit mode

remove the type = "source" argument?

ADD REPLY
0
Entering edit mode

Thanks for your answer. It doesn't work, I still have the warning:

Warning in install.packages :
  installation of package ‘C:/R/Packages/org.Mm.eg.db_3.10.0.tar.gz’ had non-zero exit status
ADD REPLY
0
Entering edit mode

I'm sorry, but can you be more explicit, showing (a) how you downloaded org.Mm.eg.db_3.10.0.tar.gz and (b) the full command and output of the install.packages() command. I say this because before you had a warning that "Rtools is required...", and addressing the first warning was what made me suggest removing the type="source" argument.

Also, the org.Mm.eg.db_3.10.0.tar.gz file should not be in the R library, it should just be in a user directory.

And probably it would help to 'Add comment' to your original Answer, so that we don't find ourselves in a very narrow column!

ADD REPLY
0
Entering edit mode

Better yet, rather than adding to a months-old post, you should start a new one. If you want to refer to the existing post, just add a link pointing to this one.

ADD REPLY
0
Entering edit mode

Ok, I didn't know I can add comment, it's simpler. I partly solved my problem. Thanks to your message, first in installed Rtools using the installr package. As it still didn't worked, I go back to the org.Mm.eg.db webpage on the bioconductor website where I noticed that I downloaded the source package (for the last version of the package, only source package is available), . As I understand, source packages are for Mac, whereas Windows use binary packages. So I downloaded binary package of a previous version, and using the install packages tool in RStudio it seemed to work :

> install.packages("~/R Packages/org.Mm.eg.db_3.0.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Program Files/R/R-3.6.3/library’
(as ‘lib’ is unspecified)

There is no warning message.

However, now, when I want to load the package I have this output :

> library(org.Mm.eg.db)
Error: package or namespace load failed for ‘org.Mm.eg.db’:
 .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
  call: NULL
  error: Failed to load extension: Le module spécifié est introuvable.

Is it possible that I have not enough memory to run the package? I have 8 Go available but I don't know if the package need more memory?

Thanks a lot for your help!

ADD REPLY
0
Entering edit mode

This is the same error as before, and now you're using an out-of-date package! So I think you should go back to using the tar.gz file.

org.Mm.eg.db_*gz t is a built 'source' package, but since there is no C code in the org packages, a built source package and a 'binary' package are the same.

The reason that you don't see the error when you install the binary package is because R doesn't try to test-load the binary package (assuming for some reason that binary installations 'must be ok'???? even though in this case it is not), but R does try to load the built source package installation.

I think the error message is misleading. What happens when you try to load the dependency

library(AnnotationDbi)

?

ADD REPLY
0
Entering edit mode

Thanks for your explanations. I removed the org.Mm.eg.db folder installed from the binary package in my R library. I downloaded the org.Mm.eg.db_3.10.0.tar.gz file from Bioconductor webpage. I closed my session last night and opened a new this morning. I tried again to install the package and as expected I had the non zero exit status warning. Then I called the AnnotationDbi library and I get this :

> library(AnnotationDbi)
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap,
    parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply,
    Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit,
    which, which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with 'browseVignettes()'. To cite
    Bioconductor, see 'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

The following object is masked from ‘package:base’:

    expand.grid


Attaching package: ‘IRanges’

The following object is masked from ‘package:grDevices’:

    windows
ADD REPLY
0
Entering edit mode

I guess the library(AnnotationDbi) call ended returning to the prompt > so the library loaded correctly. Hmm... Next try -- install org.Mm.eg.db without 'test-loading' it

install.packages("org.Mm.eg.db_3.10.0.tar.gz", repos=NULL, INSTALL_opts = "--no-test-load")

It should install ? Then

library(org.Mm.eg.db)

which I guess fails. Immediately after, say

traceback()

and provide the output.

ADD REPLY
0
Entering edit mode

You're right, when I install the package without test-loafing it, it seems to work. (it ended with DONE (org.Mm.eg.db) then it returned to the prompt).

When I say library(org.Mm.eg.db) it ended with an error :

Error: package or namespace load failed for ‘org.Mm.eg.db’:
 .onLoad failed in loadNamespace() for 'org.Mm.eg.db', details:
  call: NULL
  error: Failed to load extension: Le module spécifié est introuvable.

And the output of the traceback is :

> traceback()
6: stop(msg, call. = FALSE, domain = NA)
5: value[[3L]](cond)
4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
3: tryCatchList(expr, classes, parentenv, handlers)
2: tryCatch({
       attr(package, "LibPath") <- which.lib.loc
       ns <- loadNamespace(package, lib.loc)
       env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)
   }, error = function(e) {
       P <- if (!is.null(cc <- conditionCall(e))) 
           paste(" in", deparse(cc)[1L])
       else ""
       msg <- gettextf("package or namespace load failed for %s%s:\n %s", 
           sQuote(package), P, conditionMessage(e))
       if (logical.return) 
           message(paste("Error:", msg), domain = NA)
       else stop(msg, call. = FALSE, domain = NA)
   })
1: library(org.Mm.eg.db)
ADD REPLY
0
Entering edit mode

Thanks for pursuing this! Can you try to walk through the following command, stopping if one of them fails?

library(AnnotationDbi)

pkgname = "org.Mm.eg.db"
libname = .libPaths()[1]
datacache = new.env(parent = emptyenv())

dbfile <- system.file("extdata", "org.Mm.eg.sqlite", package = pkgname,
                      lib.loc = libname)
dbconn <- dbFileConnect(dbfile)
datacache[["dbconn"]] <- dbconn
sPkgname <- sub(".db$", "", pkgname)
sqlite <- system.file(
    "extdata", paste(sPkgname, ".sqlite", sep = ""),
    package = pkgname, lib.loc = libname
)
txdb <- loadDb(sqlite, packageName = pkgname)
dbNewname <- AnnotationDbi:::dbObjectName(pkgname, "OrgDb")

ann_objs <- createAnnObjs.SchemaChoice(
    "MOUSE_DB", "org.Mm.eg", "Mouse", dbconn, datacache
)

packageStartupMessage(AnnotationDbi:::annoStartupMessages("org.Mm.eg"))

Both dbfile and sqlite should point to files on your computer.

ADD REPLY
0
Entering edit mode

Thank you for helping me and spending time on my problem!

> pkgname = "org.Mm.eg.db"
> libname = .libPaths()[1]
> datacache = new.env(parent = emptyenv())
> dbfile <- system.file("extdata", "org.Mm.eg.sqlite", package = pkgname,
+                       lib.loc = libname)
> dbconn <- dbFileConnect(dbfile)
Error in dbFileConnect(dbfile) : DB file '' not found
ADD REPLY
0
Entering edit mode

I guess this means that if you type dbfile it would return '', which means that it is not in the location indicated by

system.file("extdata", "org.Mm.eg.sqlite", package = pkgname, lib.loc = libname)

It would be great if you tried to debug these errors on your end. the most likely problem is that org.Mm.eg.db is not installed in the file path given by .libPaths()[1]. You could try the other locations in .libPaths(), e.g.,

libname = .libPaths()[2]
system.file("extdata", "org.Mm.eg.sqlite", package = pkgname, lib.loc = libname)

etc.

If you find that a different subscript on .libPaths()[] works, then try to evaluate the remainder of the commands I indicated above.

This also makes me wonder whether anti-virus software has interfered with your installation. Once I've found the location of the installed package

> pkgpath = file.path(.libPaths()[1], "org.Mm.eg.db")
> dir.exists(pkgpath)
[1] TRUE

(maybe for you it's a different .libPaths() subscript?) I'd expect to see

> dir(file.path(pkgpath, "extdata"))
[1] "org.Mm.eg.sqlite"

Is that what you see?

ADD REPLY
0
Entering edit mode

When I type .libPaths()[2] I have :

> .libPaths()[2]
[1] "C:/Program Files/R/R-3.6.3/library"

It seems to be the path where org.Mm.eg.db is installed as at this path I have a folder named org.Mm.eg.db. (.libPaths()[1] give me another path where there is no org.Mm.eg.db folder). However, when I use the command with .libPaths()[2] I have another error :

> library(AnnotationDbi)
> 
> pkgname = "org.Mm.eg.db"
> libname = .libPaths()[2]
> datacache = new.env(parent = emptyenv())
> 
> dbfile <- system.file("extdata", "org.Mm.eg.sqlite", package = pkgname,
+                       lib.loc = libname)
> dbconn <- dbFileConnect(dbfile)
Error: Failed to load extension: Le module spécifié est introuvable.

("Le module spécifié est introuvable" means that R didn't find the module).

Concerning the anti-virus software hypothesis, I have the same think than you :

> pkgpath = file.path(.libPaths()[2], "org.Mm.eg.db")
> dir.exists(pkgpath)
[1] TRUE
> 
> dir(file.path(pkgpath, "extdata"))
[1] "org.Mm.eg.sqlite"
ADD REPLY
0
Entering edit mode

I know it doesn't seem like it, but this is a great step forward. We now have a very straight-forward example to work with. dbFileConnect() is defined in the AnnotationDbi package, but it calls a function DBI::dbConnect(), and we can mimic this with

dbfile <- system.file("extdata", "org.Mm.eg.sqlite", package = "org.Mm.eg.db")
dbconn <- DBI::dbConnect(RSQLite::SQLite(), dbname = dbfile, cache_size = 64000L,
            synchronous = "off", flags = RSQLite::SQLITE_RO)

I guess this fails for you?

We can try to see if this is limited to the org.Mm.eg.db.sqlite file, or to other sqlite databases. Try

library(RSQLite)
example(RSQLite)

If that fails, I suggest trying, IN A NEW R SESSION, to install RQLite again

BiocManager::install("RSQLite")

and trying again to run example(RSQLite).

ADD REPLY
0
Entering edit mode

The first command failed :

> dbfile <- system.file("extdata", "org.Mm.eg.sqlite", package = "org.Mm.eg.db")
> dbconn <- DBI::dbConnect(RSQLite::SQLite(), dbname = dbfile, cache_size = 64000L,
+                          synchronous = "off", flags = RSQLite::SQLITE_RO)
Erreur : Failed to load extension: Le module spécifié est introuvable.

Using RSQLite it failed too :

> library(RSQLite)
> example(RSQLite)

RSQLit> library(DBI)

RSQLit> # Initialize a temporary in memory database and copy a data.frame into it
RSQLit> con <- dbConnect(RSQLite::SQLite(), ":memory:")
Erreur : Failed to load extension: Le module spécifié est introuvable.

I closed my R session and re opened one, then I re installed RSQLite :

> BiocManager::install("RSQLite")
Bioconductor version 3.10 (BiocManager 1.30.10), R 3.6.3 (2020-02-29)
Installing package(s) 'RSQLite'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/RSQLite_2.2.0.zip'
Content type 'application/zip' length 2275367 bytes (2.2 MB)
downloaded 2.2 MB

package ‘RSQLite’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Propriétaire\AppData\Local\Temp\RtmpwZ3nAN\downloaded_packages
> example(RSQLite)
Warning message:
In example(RSQLite) : no help found for ‘RSQLite’
ADD REPLY
0
Entering edit mode

The package needs to be loaded for example(RSQLite) to find the examples, so

library(RSQLite)
example(RSQLite)
ADD REPLY
0
Entering edit mode

Oops... So, when I load the package, I have an error again :

> BiocManager::install("RSQLite")
Bioconductor version 3.10 (BiocManager 1.30.10), R 3.6.3 (2020-02-29)
Installing package(s) 'RSQLite'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/RSQLite_2.2.0.zip'
Content type 'application/zip' length 2275367 bytes (2.2 MB)
downloaded 2.2 MB

package ‘RSQLite’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Propriétaire\AppData\Local\Temp\RtmpaGbJtt\downloaded_packages
> library(RSQLite)
> example(RSQLite)

RSQLit> library(DBI)

RSQLit> # Initialize a temporary in memory database and copy a data.frame into it
RSQLit> con <- dbConnect(RSQLite::SQLite(), ":memory:")
Error: Failed to load extension: Le module spécifié est introuvable.
ADD REPLY
0
Entering edit mode

Perfect! It's not our problem! ;) I would guess that the library path where the package is installed has non-ASCII (e.g., accented) characters or spaces. I have

> installed.packages()["RSQLite", "LibPath"]
[1] "/Users/ma38727/Library/R/4.0/Bioc/3.11/library"

And you?

If this is the case, evaluate remove.packages("RSQLite") (repeat until R says there are no more packages to remove), and restart R.

Create a directory somewhere on your system with only standard ASCII characters and no spaces, c:/Path/To/Directory.

Install RSQLite there -- install.packages("RSQLite", lib = "c:/Path/To/Directory", repos = "https://cran.r-project.org")

Then load and evaluate

library("RSQLite", lib.loc = "c:/Path/To/Directory")
example(RSQLite)

(it might be necessary to use c("c:/Path/To/Directory", .libPaths()) as the lib.loc argument)

ADD REPLY
0
Entering edit mode

Indeed, there is a "é" character in the library path :

> installed.packages()["RSQLite", "LibPath"]
[1] "C:/Users/Propriétaire/Documents/R/win-library/3.6"

(for org.Mm.eg.db I choosed another path without non-ASCII characters but I didn't think about other packages)

Then I followed your instructions and as I understand, RSQLite seems to work :

> library("RSQLite", lib.loc = "C:/Program Files/R/R-3.6.3/library")
> example(RSQLite)

RSQLit> library(DBI)

RSQLit> # Initialize a temporary in memory database and copy a data.frame into it
RSQLit> con <- dbConnect(RSQLite::SQLite(), ":memory:")

RSQLit> data(USArrests)

RSQLit> dbWriteTable(con, "USArrests", USArrests)

RSQLit> dbListTables(con)
[1] "USArrests"

RSQLit> # Fetch all query results into a data frame:
RSQLit> dbGetQuery(con, "SELECT * FROM USArrests")
   Murder Assault UrbanPop Rape
1    13.2     236       58 21.2
2    10.0     263       48 44.5
3     8.1     294       80 31.0
4     8.8     190       50 19.5
5     9.0     276       91 40.6
6     7.9     204       78 38.7
7     3.3     110       77 11.1
8     5.9     238       72 15.8
9    15.4     335       80 31.9
10   17.4     211       60 25.8
11    5.3      46       83 20.2
12    2.6     120       54 14.2
13   10.4     249       83 24.0
14    7.2     113       65 21.0
15    2.2      56       57 11.3
16    6.0     115       66 18.0
17    9.7     109       52 16.3
18   15.4     249       66 22.2
19    2.1      83       51  7.8
20   11.3     300       67 27.8
21    4.4     149       85 16.3
22   12.1     255       74 35.1
23    2.7      72       66 14.9
24   16.1     259       44 17.1
25    9.0     178       70 28.2
26    6.0     109       53 16.4
27    4.3     102       62 16.5
28   12.2     252       81 46.0
29    2.1      57       56  9.5
30    7.4     159       89 18.8
31   11.4     285       70 32.1
32   11.1     254       86 26.1
33   13.0     337       45 16.1
34    0.8      45       44  7.3
35    7.3     120       75 21.4
36    6.6     151       68 20.0
37    4.9     159       67 29.3
38    6.3     106       72 14.9
39    3.4     174       87  8.3
40   14.4     279       48 22.5
41    3.8      86       45 12.8
42   13.2     188       59 26.9
43   12.7     201       80 25.5
44    3.2     120       80 22.9
45    2.2      48       32 11.2
46    8.5     156       63 20.7
47    4.0     145       73 26.2
48    5.7      81       39  9.3
49    2.6      53       66 10.8
50    6.8     161       60 15.6

RSQLit> # Or do it in batches
RSQLit> rs <- dbSendQuery(con, "SELECT * FROM USArrests")

RSQLit> d1 <- dbFetch(rs, n = 10)      # extract data in chunks of 10 rows

RSQLit> dbHasCompleted(rs)
[1] FALSE

RSQLit> d2 <- dbFetch(rs, n = -1)      # extract all remaining data

RSQLit> dbHasCompleted(rs)
[1] TRUE

RSQLit> dbClearResult(rs)

RSQLit> # clean up
RSQLit> dbDisconnect(con)

(In RStudio I have a dataframe called USArrest and other stuff)

ADD REPLY
0
Entering edit mode

Yes, so the solution seems to be to install RSQLite in a library without spaces or non-ASCII characters in the path.

Probably the best approach is to avoid non-ASCII characters in all libraries / user directories. (I know that this has been made more robust in R-4.0.0, to be released at the end of this week, but I am not sure about the extent of the revisions).

I hope this gets you back in the right direction for working with org.Mm.eg.db, and thank you very much for your persistence!

ADD REPLY
0
Entering edit mode

There is an open issue on the RSQLite issue tracker https://github.com/r-dbi/RSQLite/issues/310 it would be great if you could pick up the thread there (or here...) and report the output of

library(RSQLite)
x <- getLoadedDLLs()[["RSQLite"]][["path"]]
x

when RSQLite is installed in a path with non-ASCII characters.

ADD REPLY
0
Entering edit mode

I tried to install org.Mm.eg.db package and it worked! Thank you very much for your help! Unfortunately, in french language with Windows, R create a library path with a non ASCII character by default. Do you know if there is a simple way to change the library path by default?

And I'm going to report the output of the getLoadedDLLs() in the GitHub thread. This is what I have when I re installed RSQLite in the first library path :

> library(RSQLite)
> x <- getLoadedDLLs()[["RSQLite"]][["path"]]
> x
[1] "C:/Users/Propriétaire/Documents/R/win-library/3.6/RSQLite/libs/x64/RSQLite.dll"
> Encoding(x)
[1] "unknown"
ADD REPLY
0
Entering edit mode

The help page ?.libPaths describes how the library search path (the return value of .libPaths()) is initialized, and .libPaths() is used to install libraries (by default, into the first element of the return value of libPaths()) and to find installed libraries. I guess Propriétaire is the user name (I know it translates literally as 'owner'...)?

So the trick is to configure .libPaths() to return a value with a better default. Do this by defining a system environment variable (google will be your friend for this)

R_LIBS="c:/a/better/path"

and make sure that the directory c:/a/better/path already exists. To avoid using the automatically created directory define the variable R_LIBS_USER=... instead. You'll be successful when you start R and .libPaths() has as its first entry the value of R_LIBS.

ADD REPLY

Login before adding your answer.

Traffic: 675 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6