Ronggui / RQDA

R-based Qualitative Data Analysis
http://rqda.r-forge.r-project.org
Other
113 stars 31 forks source link

No such table/collums (impossible to encode or set attributes to files) #35

Closed choukanais closed 5 years ago

choukanais commented 5 years ago

Hi there,

I've been trying to start using RQDA for a few days. I've done the recommended installation steps (even tried to uninstall and reinstall a couple of times) but I can't create any project. I receive the error message below. I've tried to look everywhere but cant find the solution. Windows 10 (64bits) Version RQDA 0.3-1 RSQLite 2.1.2

> library(RQDA)
Le chargement a nécessité le package : RSQLite
Le chargement a nécessité le package : gWidgetsRGtk2
Le chargement a nécessité le package : RGtk2
Le chargement a nécessité le package : gWidgets
Le chargement a nécessité le package : cairoDevice
Le chargement a nécessité le package : DBI 

Use 'RQDA()' to start the programme. 

Warning: changing locked binding for ‘n’ in ‘gWidgets’ whilst loading ‘RQDA’ 

(rsession.exe:12256): Gtk-WARNING **: Impossible de trouver l'ic�ne ��gtk-file��. Le th�me ��hicolor�� n'a pas non plus �t� trouv�. Peut-�tre avez-vous besoin de l'installer. Vous pouvez obtenir une copie �:
    http://icon-theme.freedesktop.org/releases

[1] "C:\\Users\\Anaïs\\Desktop\\test"
Erreur : Could not connect to database: unable to open database file
>

Thought it might be because of RSQLite so I tried to downgrade it to the 2.0 version. But again I couldn't do so:

> install.packages("E:/Anaïs/Téléchargements/RSQLite_2.0.tar.gz", repos = NULL, type = "source")
Installing package into ‘C:/Users/Anaïs/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified)
* installing *source* package 'RSQLite' ... 
** package 'RSQLite' correctement décompressé et sommes MD5 vérifiées 
** using staged installation 
Warning in file(file, if (append) "a" else "w") :   impossible d'ouvrir le fichier 'C:/Users/Anaos/Documents/R/win-library/3.6/00LOCK-RSQLite/00new/RSQLite/DESCRIPTION' : No such file or directory Error in file(file, if (append) "a" else "w") :
    impossible d'ouvrir la connexion ERROR: installing package DESCRIPTION failed for package 'RSQLite' 
* removing 'C:/Users/Anaïs/Documents/R/win-library/3.6/RSQLite' 
* restoring previous 'C:/Users/Anaïs/Documents/R/win-library/3.6/RSQLite' Warning in install.packages :   installation of package ‘E:/Anaïs/Téléchargements/RSQLite_2.0.tar.gz’ had non-zero exit status
--
>

I tried to use the portable version but that doesn't work either. I get the following error message: "unable to initialize the JIT".

I'm not so bad with computers but a complete newb with all this... I hope someone will be able to help!

BroVic commented 5 years ago

Try running library(RQDA) again. Then present the output of the following:

  1. sessionInfo()
  2. .libPaths()
  3. grepl("sqlite", Sys.getenv("PATH"))

I'm not a maintainer, but your problem may have something to do with your library configuration. I noticed that your working directory is a child of Desktop and your packages are being installed downstream of Documents.

sqlite.exe and its related binaries are part and parcel of the RSQLite package, but your session will have to "see" them for them to be usable. If you don't have SQLite separately/externally installed, this may present a problem. This is just an educated guess - something for you to consider.

choukanais commented 5 years ago

Thanks for your reply!

Here is sessionInfo:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RQDA_0.3-1           DBI_1.0.0            gWidgetsRGtk2_0.0-86
[4] cairoDevice_2.28     gWidgets_0.0-54.1    RGtk2_2.20.36       
[7] RSQLite_2.1.2       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3      digest_0.6.22   zeallot_0.1.0   crayon_1.3.4   
 [5] backports_1.1.5 magrittr_1.5    pillar_1.4.2    rlang_0.4.1    
 [9] blob_1.2.0      vctrs_0.2.0     tools_3.6.1     bit64_0.9-7    
[13] igraph_1.2.4.1  bit_1.1-14      compiler_3.6.1  pkgconfig_2.0.3
[17] memoise_1.1.0   tibble_2.1.3 

.libPaths() :

> .libPaths()
[1] "C:/Users/Anaïs/Documents/R/win-library/3.6"
[2] "C:/Program Files/R/R-3.6.1/library"

grepl("sqlite", Sys.getenv("PATH"))

> grepl("sqlite", Sys.getenv("PATH"))
[1] FALSE
BroVic commented 5 years ago

What happens if you set your working directory somewhere below C:/Users/.../Documents/?

choukanais commented 5 years ago

Not sure I did the right thing. Is that what you meant?

[1] "C:\\Users\\Anaïs\\Documents\\Test"
Erreur : Could not connect to database:
unable to open database file

I just installed SQLite (if I did it correctly).

BroVic commented 5 years ago

Yes you did the right thing. Let's check where your R session HOME is with path.expand("~")

Okay, if you install SQLite make sure its on system PATH. I usually install it in C:\sqlite. If you don't know how to set system PATH, check this article.

choukanais commented 5 years ago

Ok created the path for SQLite

Here is for R session

> path.expand("~")
[1] "C:\\Users\\Anaïs\\Documents"
BroVic commented 5 years ago

Uhm, I just noticed that your directory path contains a non-ASCII character (in your name). In line with this SO question, move to a path that doesn't contain that word, just for the purpose of this issue. Then try again.

choukanais commented 5 years ago

OK, took me some time to do so but I changed the default library to the system library in order to avoid the non-ASCII character.

I can now open a project but another issue comes up:

[1] "E:\\RQDA_Entretiensthese\\QDAentretiensthese.rqda"
Erreur : no such table: annotation
Erreur : no such table: annotation
>

When I first opened it here is what I got:

> library(RQDA) 
Use 'RQDA()' to start the programme.
Warning: changing locked binding for ‘n’ in ‘gWidgets’ whilst loading ‘RQDA’  (rsession.exe:5668): Gtk-WARNING **: Impossible de trouver l'ic�ne ��gtk-file��. Le th�me ��hicolor�� n'a pas non plus �t� trouv�. Peut-�tre avez-vous besoin de l'installer.
 Vous pouvez obtenir une copie �:
    http://icon-theme.freedesktop.org/releases [1] "E:\\test"
 Error in (function (classes, fdef, mtable)  :
    unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"NULL", "character"’
 De plus : There were 12 warnings (use warnings() to see them) 
> warnings()
 Messages d'avis :
 1: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 2: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 3: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 4: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 5: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 6: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 7: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 8: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 9: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 10: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 11: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
 12: In result_fetch(res@ptr, n = n) :   SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
>
BroVic commented 5 years ago

What were you doing when you got the first error? It seems you were in the RQDA GUI.

As for the second error, I have had something similar when I tried to use an R script to open an RQDA project i.e a path to an .rqda file or add a file to the project i.e. path to a .txt file, when in fact I was supplying the directory path.

choukanais commented 5 years ago

Yes, I was in the RQDA GUI. I was trying to apply a code to a file. I get the same kind of error message when trying to create an attribute :

Erreur : no such table: attributes
>

I'm not sure I got the second explanation... I get the same kind of message when trying to work on files (encoding mostly):

[1] "E:\\test.rqda"
Erreur : no such table: annotation
De plus : Warning messages:
1: In result_fetch(res@ptr, n = n) :
  SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
2: In result_fetch(res@ptr, n = n) :
  SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
3: In result_fetch(res@ptr, n = n) :
  SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
4: In result_fetch(res@ptr, n = n) :
  SQL statements must be issued with dbExecute() or dbSendStatement() instead of dbGetQuery() or dbSendQuery().
Erreur : no such table: annotation
> 
BroVic commented 5 years ago

Can you check that .rqda file? Since it's effectively an SQLite database, the easiest way would be to run this at the command line

sqlite3 test.rqda

At the SQLite prompt, type

.tables

Another way is to do this within R by calling

library(RSQLite)
con <- dbConnect(SQLite(), "test.rqda")
dbListTables(con)
dbDisconnect(con)

Any of these should list all the tables normally found in an RQDA project - annotation, attribute, source, coding, etc. (For more details of the tables, check ?RQDA::RQDATables)

I believe we're gradually getting there...

choukanais commented 5 years ago

We surely are (thank you so much for helping, this is life-saving...well PhD-saving at least, which may more or less be the same xD)!

Here are the tables... I guess it's not right compared to RQDA tables:

> library(RSQLite)
> con <- dbConnect(SQLite(), "test.rqda")
> dbListTables(con)
 [1] "caselinkage" "cases"       "codecat"    
 [4] "coding"      "coding2"     "filecat"    
 [7] "freecode"    "project"     "source"     
[10] "treecode"    "treefile"   
> dbDisconnect(con)
BroVic commented 5 years ago

Well, as you've noted, there are no attributes or annotation tables. I don't fully know how table creation is implemented in RQDA, but the others you've shown are valid RQDA tables. So, you're on the right track. It's possible that some tables are missing because of the stage the project is at...

So, the question might be the workflow you've applied after opening the GUI. I recommend this tutorial (you might prefer it in French) just in case you didn't quite get it right.

I'm available for further questions - I'm currently using RQDA for a project and still learning how to use it.

choukanais commented 5 years ago

Thank you for your help! I created the project while watching the tutorial so unfortunately I'm not sure the solution's there. I'll look into the tables implementation and will post the solution (in the hope I'll find one!).

BroVic commented 5 years ago

You're welcome. I suggest you study the RQDA documentation as well as the RQDA project site. I'm interested in knowing how you solve the issue.

choukanais commented 5 years ago

I'm changing the topic to make it more consistent with how the problem has evolved -.-'

martinhajek commented 5 years ago

I am not an expert but maybe the problem could still be in another non-ASCII character hanging in some path or filename. It could occur already during the installation. Have you tried the standalone version of RQDA?

choukanais commented 5 years ago

Standalone meaning installed version or the portable one? I have moved the portable files outside the non-ASCII character file which definitely was the problem to make them work. But then same issue as the installed version with tables and all that.

martinhajek commented 5 years ago

Sorry, I actually did mean the portable version of RQDA for Windows, which is described in Metin Caliskan's tutorial Part 25.

choukanais commented 5 years ago

I have the same issues with the portable version unfortunately...

BroVic commented 5 years ago

I will help look into it a little later.

choukanais commented 5 years ago

UPDATE: problem solved! It works when the rqda project is saved on my C:/ drive but not within the user file which contains the non-ASCII character. Somehow RQDA doesn't work when I work from my computer's other hard-drives (like the E:/ drive)! Thank you so much for all your help. I can now get to work!

BroVic commented 5 years ago

Fantastic. Point of information - this non-ASCII matter is entirely an SQLite thing (in this instance). Cheers!