This is a test version of Biostars. For the public version, visit https://www.biostars.org.
packages installation in linux error

I am trying to install dbDriver package in linux using conda but its showing error. The command used:

conda install -c r r-dbi

The script which require this package(first few lines):

#!/bin/R
"%&%" <- function(a,b) paste(a,b, sep='')
driver <- dbDriver('SQLite')
model_summaries <- read.table('/home/Model_training_chr22_model_summaries.txt',header = T, stringsAsFactors = F)

The error: Error in dbDriver("SQLite") : could not find function "dbDriver" Execution halted (train)

Then I went ahead and install rsqlite package to see if that works. The command used:

 conda install -c conda-forge r-rsqlite 

The error: Error: Couldn't find driver SQLite. Looked in:

  • global namespace
  • in package called SQLite
  • in package called RSQLite Execution halted
conda linux sqlite dbdriver r

Hi,

Did you import the package where the function dbDriver() is provided? (Which I guess is DBI after searching - link)

You might have more errors/problems, but the error message could not find function "dbDriver" suggests that you didn't import/load the package DBI.

So, please import and check if that works by doing one of two things:

library("DBI") # the 2nd line in your script after the shebang

2.

driver <- DBI::dbDriver('SQLite') # substitute this line by your line in your script

Let us know if this worked for you!

António

Hello, I tried the above suggestion. So now my script looks like:

#!/bin/R
library("DBI")
"%&%" <- function(a,b) paste(a,b, sep='')
driver <- DBI::dbDriver('SQLite')

But I am still getting the error:

Error: Couldn't find driver SQLite. Looked in:

  • global namespace
  • in package called SQLite
  • in package called RSQLite Execution halted

Can you try to install inside R the package RSQLite instead using conda by typing one of the commands (the 1st tries to install from CRAN, and the 2nd that relies on the package devtools tries to install from the latest version from the GitHub repository):

install.packages("RSQLite") # 1st from CRAN

# install.packages("devtools")
devtools::install_github("rstats-db/RSQLite") # latest version from Github

In your script you just need to load the whole package (library("DBI")) or load only the function that you need to use from the package (with DBI::dbDriver('SQLite')), not both (although it doesn't hurt!).

0 answers

No answers yet.

Log in to answer this question.