zellkonverter
zellkonverter copied to clipboard
Problem at Zellkonverter finding conda environment
Hello,
I am trying to convert SingleCellExperiment object to Anndata/h5ad using writeH5AD, however I get this error:
library(zellkonverter) Registered S3 method overwritten by 'zellkonverter': method from
py_to_r.numpy.ndarray reticulate setZellkonverterVerbose(TRUE) writeH5AD(Traj_RNA, file = 'D:/Python_coding/File_name.h5ad') ℹ Using anndata version 0.8.0 Error in use_condaenv(envpath, required = TRUE) : Unable to locate conda environment 'C:/Users/yanst/AppData/Local/R/cache/R/basilisk/1.10.2/zellkonverter/1.8.0/zellkonverterAnnDataEnv-0.8.0'. In addition: Warning messages: 1: In system(paste(act.cmd, collapse = " "), intern = TRUE) : running command '"C:\Users\yanst\AppData\Local/R/cache/R/basilisk/1.10.2/0/condabin/conda.bat" activate "C:\Users\yanst\AppData\Local\R\cache\R\basilisk\1.10.2\zellkonverter\1.8.0\zellkonverterAnnDataEnv-0.8.0" && C:/PROGRA~1/R/R-42~1.2/bin/x64/Rscript --no-save --no-restore --no-site-file --no-init-file --default-packages=NULL -e "con <- socketConnection(port=11367, open='wb', blocking=TRUE);serialize(Sys.getenv(), con);close(con)"' had status 1 2: In socketAccept(soc, blocking = TRUE, open = "a+b") : problem in accepting connections on this socket 3: In .activate_condaenv(output, envpath, loc) : failed to activate the environment at 'C:\Users\yanst\AppData\Local\R\cache\R\basilisk\1.10.2\zellkonverter\1.8.0\zellkonverterAnnDataEnv-0.8.0'
Here is the SessionInfo:
R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale: [1] LC_COLLATE=Hebrew_Israel.utf8 LC_CTYPE=Hebrew_Israel.utf8 LC_MONETARY=Hebrew_Israel.utf8 [4] LC_NUMERIC=C LC_TIME=Hebrew_Israel.utf8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] zellkonverter_1.8.0
loaded via a namespace (and not attached): [1] Rcpp_1.0.9 XVector_0.38.0 GenomeInfoDb_1.34.9
[4] pillar_1.9.0 compiler_4.2.2 BiocManager_1.30.22
[7] basilisk.utils_1.10.0 zlibbioc_1.44.0 bitops_1.0-7
[10] MatrixGenerics_1.10.0 tools_4.2.2 SingleCellExperiment_1.20.0 [13] jsonlite_1.8.7 lifecycle_1.0.4 tibble_3.2.1
[16] lattice_0.20-45 pkgconfig_2.0.3 png_0.1-7
[19] rlang_1.1.1 Matrix_1.6-2 dir.expiry_1.6.0
[22] DelayedArray_0.23.2 sceasy_0.0.7 cli_3.6.1
[25] rstudioapi_0.15.0 filelock_1.0.2 parallel_4.2.2
[28] xfun_0.41 GenomeInfoDbData_1.2.9 dplyr_1.1.3
[31] knitr_1.45 rappdirs_0.3.3 IRanges_2.32.0
[34] generics_0.1.3 vctrs_0.6.3 S4Vectors_0.36.0
[37] stats4_4.2.2 grid_4.2.2 tidyselect_1.2.0
[40] Biobase_2.58.0 reticulate_1.26 glue_1.6.2
[43] R6_2.5.1 fansi_1.0.3 basilisk_1.10.2
[46] magrittr_2.0.3 GenomicRanges_1.49.0 matrixStats_0.62.0
[49] BiocGenerics_0.44.0 SummarizedExperiment_1.28.0 utf8_1.2.2
[52] RCurl_1.98-1.9
I checked the folder mentioned in the error message and it exists but is empty for some reason, however under the 'basilisk' folder I can see a Miniconda app. I am using a Windows 10 OS. Re-installing basilisk, basilisk.utils and zellkonverter failed to resolve the issue. I have other conda environments which are available and I use them with my Python coding, If all else fails, I am willing to use them but I don't know how to set basilisk to use them in R. Apologies if my question is too elementary, my proficiency in Python and managing python packages using Conda is still not quite good.
Thanks in advance for any help.
Hi @Yanst86
It seems like the environment hasn't been created correctly. Could you please try deleting the cache directory where the environment should be (the path at the end of the error message)? That should trigger the environment to be re-created.
Had this same issue after some software updates and can confirm that it worked after deleting the basilisk
cache directory and restarting the R session, i.e. rm -rf ~/.cache/R/basilisk/
.