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

question about localDBConn arguments / error in guess_header #55

Open
corakingdon opened this issue Apr 18, 2019 · 15 comments
Open

question about localDBConn arguments / error in guess_header #55

corakingdon opened this issue Apr 18, 2019 · 15 comments
Labels

Comments

@corakingdon
Copy link

I'm using GCAM for the first time and would like to use rgcam to further analyze the results. I think I'm just confused about what the arguments to localDBConn are supposed to be, so hopefully this is an easy question!

I've run the reference GCAM configuration, as well as the five SSP scenarios, and I am able to view the results using the GCAM ModelInterface. In the default setup, a folder "output/database_basexdb" was created containing several basex files. When I use the GCAM ModelInterface, I select the whole folder "output/database_basexdb" in order to view the results.

But when trying to use rgacm, I'm having trouble with the localDBConn call. I'm not sure what I'm supposed to be providing as dbPath and dbFile. I've tried the following (where the provided path is the same that works for ModelInterface).

# Option 1: is `dbFile` supposed to be one of the many basex files in the db folder?
conn = localDBConn('M:/gcam-v5.1.3-Windows-Release-Package/output/database_basexdb', 'tbl.basex')

# Option 2: is `dbFile` supposed to be the entire db folder?
conn = localDBConn('M:/gcam-v5.1.3-Windows-Release-Package/output', 'database_basexdb')

My error in both cases is the following:

Error in guess_header_(datasource, tokenizer, locale) : 
  Cannot read file C:/Users/kingdon/AppData/Local/Temp/RtmpQDCMCP/file5502c53679: The volume for a file has been externally altered so that the opened file is no longer valid.

This seems like there might be something else wrong with my R setup, but even if that's the case, my question about dbPath and dbFile still stands! Thanks in advance for any help!

@rplzzz
Copy link
Contributor

rplzzz commented Apr 23, 2019

Your option 2 is the correct one. Even though the database is structured as a folder on the disk, it is logically a single "database file".

As to the error you are getting, I've not seen it before. From what I can tell, it's an error that Windows produces when there's a problem with the filesystem. See, for example the answers here:
https://www.quora.com/What-does-the-volume-for-the-file-has-been-externally-altered-and-is-no-longer-valid-mean

@corakingdon
Copy link
Author

corakingdon commented Apr 23, 2019

Thanks for the clarification! I got it working.

@LeonardoFrid
Copy link

I am also experiencing exactly the same problem. How did you resolve this?

@Silviameteoro
Copy link

Hi,
I am also having the same issue in rgcam. Could you let us know how you solved the problem? Thanks a lot.

@corakingdon
Copy link
Author

Hi, I'm really sorry but now I can't remember how I resolved this. I think it might have been that I was mis-specifying the path to the directory, but I'm not sure. Make sure you give it the full path to the output directory

@rplzzz
Copy link
Contributor

rplzzz commented Sep 25, 2019

@Silviameteoro could you tell me what version of the readr package you have installed?

@rplzzz rplzzz reopened this Sep 25, 2019
@rplzzz rplzzz changed the title question about localDBConn arguments question about localDBConn arguments / error in guess_header Sep 25, 2019
@pralitp
Copy link
Contributor

pralitp commented Sep 25, 2019

@rplzzz, note the error really doesn't have anything to do with readr (see #50; I've fixed the issue in readr which produces the message and I assume will be included the next release).

The real error is it is unable to open the database for whatever reason. I think we will need more details from the users including the exact commands they have tried.

@zarrarkhan
Copy link
Collaborator

@rplzzz @pralitp @Silviameteoro

So basically we are runningthe localDBConn command with a database path and the database name and we get the error being discussed here:

rgcam::localDBConn(gcamdatabasePath_i,gcamdatabaseName_i)

Error in guess_header_(datasource, tokenizer, locale) : Cannot read file C:/Users/sant073/AppData/Local/Temp/RtmpWKBvlu/file20dc727515e4: The volume for a file has been externally altered so that the opened file is no longer valid.

Some notes to summarize what we have tried so far:

  • Another user (@FeralFlows) was having this issue and re-installed rgcam after deleting all the libraries and it started to work for him
  • This problem is only happening on Silvia's (@Silviameteoro) desktop. rgcam is working fine on my desktop/laptop as well as her laptop.
  • We have tested the command with multiple databases which work with rgcam on other machines. These databases can be opened in Model Interface on Silvia's desktop.
  • We have also tried saving the databases in different locations and refining the paths to localDBConn.
  • We also deleted rgcam and all its libraries and rebuilt rgcam directly from the github page.
  • We also tried reinstalling R and R studio and tried this with both R 3.5 and 3.6.

@rplzzz
Copy link
Contributor

rplzzz commented Sep 25, 2019

@pralitp Maybe a failure in trying to run the query then? Would it be worth turning on the option to capture the model interface's console output?

@pralitp
Copy link
Contributor

pralitp commented Sep 25, 2019

Maybe, although the simple query we run to test if the localDBConn is configured correctly is entirely through BaseX and the model interface isn't in the loop. Although we could try to run a regular query on the connection even though the open "failed" with the migabble=FALSE and see if the model interface can give some insight then.

@Silviameteoro
Copy link

Hi @rplzzz,

The rgcam version I have installed is 1.0.0.

@pralitp
Copy link
Contributor

pralitp commented Nov 19, 2019

I wonder if this was related to #68: basically the value for the maximum memory set inside of the package is greater than your system can provide (possibly due to a 32-bit version of Java) localDBConn will fail immediately with no helpful error messages.

We've just fixed that issue by allowing users to explicitly set the max memory. Perhaps try updating to the latest version (1.1.0) and setting the max memory value at 1 GB: localDBConn(maxMemory="1g"). If that allows you to open the DB that was indeed the problem. Most users may not need more than that, but sometimes they do (#31). You can experiment with how much memory your system will allow or perhaps install / force R to use a 64-bit version of Java.

@ypwong22
Copy link

Just throwing my two cents on the problem: it might be because the path is too long, or the folder to the database is sync-ed on cloud. I was experiencing the same issue, and it disappeared after I copied the whole GCAM directory out of my OneDrive sync-ed folder into C:/user/admin/Documents/

@realxinzhao
Copy link

I think the trick is that the working dictionary has to be different than the /path/to/dbs !!! And then conn = localDBConn(/path/to/dbs, database_basexdb). E.g., it worked for me with setwd(/path/to/dbs/results). I did not know why. But I got the same error otherwise.

@JiachenWang1995
Copy link

In my case,

db_conn <- localDBConn("D:/GCAM/gcam-core-gcam-v5.1.3/output", "database_basexdb")
db_conn <- localDBConn("D:/GCAM/gcam-core-gcam-v5.1.3/output/", "database_basexdb")

the first one works well, the second one fails (with the same error in guess_header_).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants