drieslab / Giotto

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

"filterGiotto unused arguments" AND "failed to initialize requested version of Python" #922

Closed vagm110901 closed 4 months ago

vagm110901 commented 4 months ago

Good morning, My name is Victor. I am trying to replicate de Giotto tutorial of Vision Brain (https://rubd.github.io/Giotto_site/articles/mouse_visium_brain_201226.html) and I am having several errors. Last week filterGiotto() function worked, however I had another error and I tried to reinstall the python environment from Conda using installGiottoEnvironment() and it seems to work and the created environment seem to be correct

checkGiottoEnvironment()

giotto environment found at /Users/vagm_110901/Library/r-miniconda-arm64/envs/giotto_env/bin/pythonw [1] TRUE

I continued with the tutorial and when I run:

 visium_brain <- filterGiotto(gobject = visium_brain,
                             expression_values = c('raw'),
                              expression_threshold = 1,
                              gene_det_in_min_cells = 50,
                              min_det_genes_per_cell = 1000,
                              verbose = T)

this error appears: Error in filterGiotto(gobject = visium_brain, expression_values = c("raw"), : unused arguments (gene_det_in_min_cells = 50, min_det_genes_per_cell = 1000)

Then I realize that the vision_brain object created, checking instructions - python_path I have an error:

visium_brain@instructions[["python_path"]]

[1] "Error in reticulate::use_python(required = TRUE, python = python_path) : \n failed to initialize requested version of Python\n" attr(,"class") [1] "try-error" attr(,"condition") <simpleError in reticulate::use_python(required = TRUE, python = python_path): failed to initialize requested version of Python> (((However this not appears always. For example, I just have reinstall all the packages of Giotto and recreate the environment of python, and now this error has solved.)))

I have tried to install python=3.6 in the environment of condo, but it does not work: << Channels:

PackagesNotFoundError: The following packages are not available from current channels:

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to https://anaconda.org and use the search bar at the top of the page. >>

Could yo help me how to solve it?

System Information

josschavezf commented 4 months ago

Hi @vagm110901 regarding the example, you are using a previous version of the website and the tutorial, you can find an updated version here: http://giottosuite.com/ then go to Examples > Visium > Visium Mouse Brain.

Regarding the filterGiotto( ) function, instead of using the arguments gene_det_in_min_cells and min_det_genes_per_cell, you have to use feat_det_in_min_cells and min_det_feats_per_cell

jiajic commented 4 months ago

Unused params in filterGiotto()

To add onto @josschavezf, Arguments referring to genes have been largely changed to features or feat to fit better with multimodal datasets.

failed to initialize requested version of python

This is more a limitation of the reticulate package, since it only attaches the python environment that is first loaded in an R session, and then you are locked to that python environment for the rest of the session. installGiottoEnvironment() creates the giotto_env python environment by default, but if another package activates another python environment first, giotto_env becomes inaccessible.

A restart of the R session and running GiottoClass::set_giotto_python_path() first should be able to force reticulate to use the giotto_env miniconda environment.

See here for more information

vagm110901 commented 4 months ago

Thank you so much to both of you, now it works and has sense.