drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

The miniconda installed on docker is not accessible to singularity #1016

Closed qiyubio closed 1 month ago

qiyubio commented 1 month ago

Describe the Error

The miniconda installed by default is /root/.local/share/r-miniconda/. When pulled by singularity (which do not support root), the miniconda env is lost.

...

Error Message

```r > library(Giotto) Loading required package: GiottoClass Giotto Suite 4.1.0 > checkGiottoEnvironment() Error: Unable to find conda binary. Is Anaconda installed? ```

To Reproduce

Steps to reproduce the behavior, i.e.:

singularity pull suite.sif docker://giottopackage/suite:v4.1.0

singularity exec suite.sif R

library(Giotto) checkGiottoEnvironment()

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem. NOTE: Screenshots of the attempted function call and full error message(s) are helpful for troubleshooting!

System Information

Please replace the following according to your machine:

Additional context

Add any other context about the problem here.

qiyubio commented 1 month ago

I will sugest to change the installation location to /opt/r-miniconda for more general usage:

# set up miniconda path
RUN mkdir -p /opt/r-miniconda
ENV RETICULATE_MINICONDA_PATH=/opt/r-miniconda

# Install Miniconda using reticulate
RUN /bin/sh -c 'R -e "reticulate::install_miniconda(path=\"/opt/r-miniconda\")"'
RUN /bin/sh -c R -e "pak::pkg_install('drieslab/Giotto')"

# Create the giotto_env environment
RUN /bin/sh -c 'R -e "Giotto::installGiottoEnvironment(force_environment = TRUE)"'
ENV export RETICULATE_PYTHON=/opt/r-miniconda/envs/giotto_env/bin/python
josschavezf commented 1 month ago

@qiyubio I have not been able to reproduce your error. When I run

singularity pull suite.sif docker://giottopackage/suite:v4.1.0

singularity exec suite.sif R

library(Giotto) checkGiottoEnvironment()

I get:

library(Giotto) Loading required package: GiottoClass Giotto Suite 4.1.0 checkGiottoEnvironment() giotto environment found at /hpc/users/chavej12/.local/share/r-miniconda/envs/giotto_env/bin/python [1] TRUE

josschavezf commented 1 month ago

@qiyubio I just updated the image using your suggested changes.

You can find it using singularity pull suite.sif docker://giottopackage/suite:latest

Now it shows:

checkGiottoEnvironment() giotto environment found at /hpc/users/chavej12/.local/share/r-miniconda/envs/giotto_env/bin/python /opt/r-miniconda/envs/giotto_env/bin/python [1] TRUE

Let me know if it solves the problem.

qiyubio commented 1 month ago

Thanks for fixing it so quickly! @ josschavezf It works fine now on our cluster.

singularity exec suite.sif R
> library(Giotto)
Loading required package: GiottoClass
Newer devel version of GiottoClass on GitHub: 0.3.5
Giotto Suite 4.1.0
>
> checkGiottoEnvironment()
giotto environment found at
 /opt/r-miniconda/envs/giotto_env/bin/python
[1] TRUE

I think there is a typo (extra = between export and RETICULATE_PYTHON), but not sure if it could make any damage, just fyi.

ENV export=RETICULATE_PYTHON=/opt/r-miniconda/envs/giotto_env/bin/python https://hub.docker.com/layers/giottopackage/suite/latest/images/sha256-dce96c35bba7bf022f775b5d11d51dd42819e8f9c96415490fb58cf1ea4e2fd9?context=explore

josschavezf commented 1 month ago

Noted, thanks for your feedback!