theislab / zellkonverter

Conversion between scRNA-seq objects
https://theislab.github.io/zellkonverter/
Other
145 stars 27 forks source link

`basilisk.R` needs to actually create the `BasiliskEnvironment` objects #66

Closed LTLA closed 2 years ago

LTLA commented 2 years ago

When BASILISK_USE_SYSTEM_DIR=1, basilisk will attempt to provision the Conda environments in the R package's installation directory at install time. This is useful in shared installations, to avoid each user provisioning their own environments; it is also helpful in situations where the filesystem is to be considered read-only after all packages are installed.

System installation relies on the package's configure calling configureBasiliskEnv(), which in turn looks at R/basilisk.R to find the definitions of the BasiliskEnvironments. These definitions are retrieved and used to provision the environments before the package itself is fully installled. However, as the latest version of zellkonverter does not create the environments inside R/basilisk.R (instead defining a function to do so), this is breaking system installations.

The simple fix is to evaluate the function twice for each version inside basilisk.R:

old_anndata_env <-  zellkonverterAnnDataEnv(old_version)
new_anndata_env <- zellkonverterAnnDataEnv(new_version)

So that configureBasiliskEnv() knows what to do.

lazappi commented 2 years ago

I thought I was being clever with how I set this up but obviously I overlooked some things. I have made the suggested fix in release and devel, re-open this if there are still issues.

LTLA commented 2 years ago

The commit almost fixes it, but not quite. basilisk.R needs to be able to evaluate without errors, i.e., running source("basilisk.R") should yield valid results. Unfortunately, the function makes a reference to .get_verbose(), which is not defined in the same file; this causes installation errors such as:

* installing *source* package ‘zellkonverter’ ...
** using non-staged installation via StagedInstall field
Error in .get_verbose(parent.frame()) : 
  could not find function ".get_verbose"
Calls: <Anonymous> -> eval -> eval -> zellkonverterAnnDataEnv
Execution halted
lazappi commented 2 years ago

Ah. I fixed that when loading the package but I didn't realise the file needs to be sourced directly. Will fix that.

lazappi commented 2 years ago

I moved all the printing out of this file so shouldn't be any issues sourcing it by itself now.