stash() is unable to open .mustash/x.hash
opened this issue · comments
I am unable to use the stash
function below.
require(mustashe)
stash("x", {
+ Sys.sleep(5)
+ x <- 5
+ })
While following a tutorial on your website, I received the following error:
Stashing object.
Error in c_qsave(x, file, preset, algorithm, compress_level, shuffle_control, :
Failed to open .mustashe/x.hash. Check file path.
In addition: Warning message:
In dir.create(.stash_dir, recursive = TRUE) :
cannot create dir '.mustashe', reason 'Permission denied'
I used install.packages("mustashe")
.
What did I do wrong?
Has this issue, or a similar one, occurred in the past?
Any help would be appreciated.
It looks like the function that is trying to save the value of x
is unable to do so. I think the telling part is the warning from dir.create()
:
In dir.create(.stash_dir, recursive = TRUE) :
cannot create dir '.mustashe', reason 'Permission denied'
The stash()
function tries to write files to .mustashe/
directory. If it is not present, then the directory is created (using dir.create()
). It looks like this failed, but threw a warning instead of an error (the default behavior of dir.create()
). It looks like you don't have permission to make a directory at your current working directory. Is it a shared drive or directory? What kind of OS are you using (e.g. Windows, MacOS, etc.)?
Is it a shared drive or directory?
It is a directory. Here is the file path:
C:\Users\msode
Also, here is an image of my terminal with the current working directory and r loaded:
What kind of OS are you using (e.g. Windows, MacOS, etc.)?
Microsoft Windows [Version 10.0.19041.450]
NOTE: The Permission denied
issue has occurred in the past for the swirl
package. But I never had that issue when I installed swirl
. Here is a link to that issue.
Many thanks.
Can you try making a directory using the dir.create()
function? Something like dir.create("some_dir")
? Does the directory get created?
Ideally, you shouldn't need to manually create the '.mustashe' directory, but for debugging purposes, I think that is a good idea. Then try the example you originally posted and see if you get the same error. If you don't get an error, use list.files(".mustashe")
to check that x.hash
is in there.
It worked.
I created the .mustashe
directory with dir.create
:
dir.create(".mustashe")
I then made a reattempt of the example on your tutorial page:
require(mustashe)
stash("x", {
+ Sys.sleep(5)
+ x <- 5
+ })
No error was thrown. So then I checked .mustashe
directory manually and in terminal:
list.files(".mustashe")
These are the contents contained in .mustashe
:
> list.files(".mustashe")
[1] "x.hash" "x.qs"
Many thanks. Take care.
Thank you for bringing this issue up. I'm going to leave it open for now so I can make a few changes to hopefully help others that run into the same problem.
For some reason when I change directories, say to one titled ms_programmingAssignment8_JHU_
, .mustashe
generates automatically. I do not know if this event is dependent on the event of me previously creating .mustashe
manually in my user directory or independent of it.
Why did .mustashe
not generate automatically for my user directory?
C:\Users\msode
But when .mustashe
is created manually in the above directory, why can .mustashe
now be generated automatically in another directory?
C:\Users\msode\Documents\GitHub\ms_programmingAssignment8_JHU_
Thoughts welcomed.
I'm glad it is working as expected in other directories. I don't think it is dependent on you having created the directory manually in your user directory. My guess is that it was due to some issue with not having permission, but then I don't see how you were able to manually create the directory. But, then again, I have limited experience with Windows.
My plan is to have stash()
throw an error if it is unable to create the directory and provide instructions for the user to do it manually. It's not an ideal implementation, but not the end of the world since it only needs to be done once per project/directory. (This will also give me an opportunity to experiment with using the 'here' package for identifying the presence of an RStudio project.)