basilisk icon indicating copy to clipboard operation
basilisk copied to clipboard

Error in installConda() : conda installation failed with status code '2'

Open maqingyue opened this issue 1 year ago • 16 comments

Hello, thank you very much for developing this software. I encountered the following error while running writeH5AD locally. How can I correct it?

writeH5AD(sce, file = 'D:/filtered_featured_bc_matrix.h5ad') Error in installConda() : conda installation failed with status code '2'

maqingyue avatar Mar 23 '23 08:03 maqingyue

Is there any other error message? Because that could mean anything.

LTLA avatar Mar 24 '23 06:03 LTLA

There is no other error reporting information. This is the entire process.

a <- readRDS("D:/BGI_learning/select-samples/results/liver/aging009-10.0.3.10.rds") sce<- as.SingleCellExperiment(a) writeH5AD(sce, file = 'D:/filtered_featured_bc_matrix.h5ad') Error in installConda() : conda installation failed with status code '2'

maqingyue avatar Mar 24 '23 06:03 maqingyue

Is your disk full? Do you have permissions to install software on the machine? Does example(basiliskRun) succeed?

vjcitn avatar Mar 24 '23 11:03 vjcitn

basilisk.utils::installConda doesn't intercept any error messages, so if nothing's being shown, then I don't know what's going on. Maybe the initial download of the installer was corrupted - you could try flushing the contents of basilisk.utils::getExternalDir(). If that still doesn't work, do debug(basilisk.utils::installConda) and step through the function until you get to

https://github.com/LTLA/basilisk.utils/blob/7ee52130919df88316f29e0be8cbd4aa4f32a6c2/R/installConda.R#L123

See what paste(c(tmploc, inst_args)) says, and try running that command on the command line.

LTLA avatar Mar 24 '23 18:03 LTLA

@LTLA , This is the result of my following your instructions.

Browse[6]> paste(c(tmploc, inst_args)) [1] "C:/Users/maqingyue/AppData/Local/R/cache/R/basilisk/Miniconda3-py37_4.8.3-Windows-x86_64.exe" [2] "/InstallationType=JustMe"
[3] "/AddToPath=0"
[4] "/RegisterPython=0"
[5] "/S"
[6] "/NoRegistry=1"
[7] "/D=C:\Users\MAQING~1\AppData\Local\R\cache\R\basilisk\18E761~1.1\0"
Browse[6]> Error in installConda() : conda installation failed with status code '2' debug: if (!success) { unlink2(dest_path, recursive = TRUE) } Browse[6]> debug: unlink2(dest_path, recursive = TRUE) Browse[6]>

The parameter "status" may come from "status<- system2 (tmploc, inst_args)" or "status<- system2 (" bash ", inst_args)". Then I also ran these two sentences of code, hoping that this will help solve the problem. Browse[7]> system2(tmploc, inst_args) Browse[7]> system2("bash", inst_args) /usr/bin/bash: /InstallationType=JustMe: No such file or directory

maqingyue avatar Mar 27 '23 06:03 maqingyue

@vjcitn , There is still space on my disk. This is my personal computer, and I should have installation permissions. Is the example (basiliskRun) you mentioned the following code? I ran the following section and finally got the same error.

my_env <- basilisk::BasiliskEnvironment(envname="my_env_name", pkgname="name.of.package", packages=c("pandas==0.25.1"))

res <- basilisk::basiliskRun(env=my_env, fun=function(args) { out <- reticulate::import("pandas") return(some_r_object) })

maqingyue avatar Mar 27 '23 06:03 maqingyue

example(basiliskRun) can be run directly right after library(basilisk). It should produce output like

> example(basiliskRun)

bslskR> ## Don't show: 
bslskR> basilisk.utils::installConda()
[1] FALSE

bslskR> ## End(Don't show)
bslskR> 
bslskR> # Creating an environment (note, this is not necessary
bslskR> # when supplying a BasiliskEnvironment to basiliskStart):
bslskR> tmploc <- file.path(tempdir(), "my_package_A")

bslskR> if (!file.exists(tmploc)) {
bslskR+     setupBasiliskEnv(tmploc, c('pandas=1.4.3'))
bslskR+ }
+ '/home/stvjc/.cache/R/basilisk/1.11.3/0/bin/conda' 'create' '--yes' '--prefix' '/tmp/Rtmps76fUd/my_package_A' 'python=3.8.13' '--quiet' '-c' 'conda-forge'
Collecting package metadata (current_repodata.json): ...working... 


If you have never seen a response like that shown above, your system will need to be modified to allow user-level conda manipulations.

vjcitn avatar Mar 27 '23 10:03 vjcitn

@vjcitn , I really don't have the corresponding output. Errors are almost identical. I don't know why personal computer need to be modified to allow user-level conda. Is the change you said changed here(fig1)? I did not successfully correct this error.

example(basiliskRun)

bslskR> ## Don't show: bslskR> basilisk.utils::installConda() Error in basilisk.utils::installConda() : conda installation failed with status code '2'

fig1 image

maqingyue avatar Mar 27 '23 11:03 maqingyue

What is the result of reticulate::py_config()?

vjcitn avatar Mar 27 '23 11:03 vjcitn

@vjcitn, the result of reticulate::py_config() is following:

reticulate::py_config() python: C:/Users/maqingyue/AppData/Local/r-miniconda/envs/r-reticulate/python.exe libpython: C:/Users/maqingyue/AppData/Local/r-miniconda/envs/r-reticulate/python38.dll pythonhome: C:/Users/maqingyue/AppData/Local/r-miniconda/envs/r-reticulate version: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:00) [MSC v.1929 64 bit (AMD64)] Architecture: 64bit numpy: C:/Users/maqingyue/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy numpy_version: 1.23.4

maqingyue avatar Mar 27 '23 11:03 maqingyue

[1] "C:/Users/maqingyue/AppData/Local/R/cache/R/basilisk/Miniconda3-py37_4.8.3-Windows-x86_64.exe"

You're using an out-of-date version. Latest basilisk.utils should pull down py38_4.12.0, not py37_4.8.3.

In any case, you need to figure out if the Conda installer runs at all on your computer. As I said, you need to extract the commands used by installConda and run them on the command line. In your case, it would be something like:

C:/Users/maqingyue/AppData/Local/R/cache/R/basilisk/Miniconda3-py37_4.8.3-Windows-x86_64.exe /InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /S /NoRegistry=1 /D=C:\Users\MAQING~1\AppData\Local\R\cache\R\basilisk\18E761~1.1\0

Not tested, of course, but I will leave the rest to you.

If this doesn't work on the command line, then it's not a basilisk problem, it's a conda problem, and that's beyond my ability to help. basilisk just wraps the conda installer at this point, so if the latter doesn't work, the former won't either.

LTLA avatar Mar 28 '23 06:03 LTLA

@vjcitn , @LTLA , Thank you for your patience and I will continue to try to solve this problem.

maqingyue avatar Mar 30 '23 08:03 maqingyue

I've run into the same error on windows devel GHA: https://github.com/alanocallaghan/densvis/actions/runs/5884832224/job/15960238189

Not sure if exactly the same reason as on GHA, but the installer runs fine if I open it directly, but silently fails with the system2 call

alanocallaghan avatar Aug 17 '23 08:08 alanocallaghan

Seems like most basilisk dependencies are failing on palomino in bioc-devel with this error:

I haven't checked the rest in detail, but it seems they either explicitly don't support windows, or they don't load conda during R CMD build/check

I've tried switching conda versions with snifter, and anything past 4.12 doesn't work on windows. Does basilisk need any newer conda features? If we have to stick with 22+, then I'm going to have to remove windows support to get bioc checks to pass.

alanocallaghan avatar Sep 03 '23 10:09 alanocallaghan

After some investigation, it seems like the latest Miniconda windows installers no longer work in silent mode, because of course they don't. AFAICT this mode is still documented as being valid on the Conda help pages, so who knows.

We can't disable silent mode because it would not be acceptable to force users to interact a point-and-click prompt, e.g., in the middle of some script. So it seems that the only solution is to roll back to the last Conda version that works. The only question is whether to do this for all OS's (for consistency) or only for Windows (so that the other OS's can have the benefit of using the latest Conda). I would prefer the former, and have done so in basilisk.utils 1.13.3.

One can only hope that conda fixes the windows situation in subsequent releases.

LTLA avatar Sep 04 '23 05:09 LTLA

Possibly related: conda/conda#10611, though the suggested fix doesn't work.

LTLA avatar Sep 04 '23 06:09 LTLA