bodkan / slendr

Population genetic simulations in R 🌍
https://bodkan.net/slendr
Other
54 stars 5 forks source link

New error upon loading library #117

Closed hmoots closed 1 year ago

hmoots commented 1 year ago

Hello! I had previously been working with slendr and everything was working okay, but now I am getting the following error when I try to load the library. I've tried reinstalling the latest version, but that doesn't seem to help.

Error: package or namespace load failed for ‘slendr’: .onLoad failed in loadNamespace() for 'slendr', details: call: py_module_import(module, convert = convert) error: ModuleNotFoundError: No module named 'tskit'

Thanks so much for any insights! Hannah

bodkan commented 1 year ago

Hello,

This error is often caused by broken conda, which is internally used by slendr for handling tree sequences and for running simulations with msprime.

Alternatively, it could be a known bug/misfeature of RStudio. For simplicity, let's focus on this for now because this is potentially easier to fix. Also, the fact that the error popped up out of nowhere despite slendr working OK before makes me think it could be RStudio-related.

This issue is discussed in detail here. Could you read through the discussion there, in particular my replies and suggestions and see if some of them work?

I'll close this issue because the linked discussion is about exactly the same error message. Every single report of this error previously was fixed by suggestions in that discussion, so I'm fairly certain it will be the same here.

bodkan commented 1 year ago

One thing that's worth pointing out -- before trying the two RStudio-focused solutions in that thread, make sure to completely restart your RStudio session. Just so that some setting here and there doesn't get transferred between individual attempts to fix this.

Also (this is stated in the thread, but pointing it out again) -- to find out whether it's RStudio or conda itself who is the culprit, try running library(slendr) in your Terminal app (not RStudio, not R console app, the good old bash terminal).

hmoots commented 1 year ago

Thanks so much! I thought I had checked for similar questions, but missed this one! And if anyone else is here with the same question, it seems to be an issue with Rstudio reloading the previous workspace. This is the relevant post from the previous thread - https://github.com/bodkan/slendr/issues/93#issuecomment-1122947659

bodkan commented 1 year ago

I'm glad the same solution applied in your case as well.

As I said in the discussion under the other issue, the whole hidden workspace business is awful and I'm really said it's turned on by RStudio by default. I've only seen it cause problems.