bioFAM / MOFA2

Multi-Omics Factor Analysis
https://biofam.github.io/MOFA2/
GNU Lesser General Public License v3.0
283 stars 49 forks source link

AttributeError: Module 'scipy' has no attribute 'shape' #156

Open nbutyrate opened 3 months ago

nbutyrate commented 3 months ago

Hi, I tgot following error after calling python from Reticulate, please help

mofa1 <- run_mofa(mofa) Connecting to the mofapy2 python package using reticulate (use_basilisk = FALSE)... Please make sure to manually specify the right python binary when loading R with reticulate::use_python(..., force=TRUE) or the right conda environment with reticulate::use_condaenv(..., force=TRUE) If you prefer to let us automatically install a conda environment with 'mofapy2' installed using the 'basilisk' package, please use the argument 'use_basilisk = TRUE'

    #########################################################
    ###           __  __  ____  ______                    ### 
    ###          |  \/  |/ __ \|  ____/\    _             ### 
    ###          | \  / | |  | | |__ /  \ _| |_           ### 
    ###          | |\/| | |  | |  __/ /\ \_   _|          ###
    ###          | |  | | |__| | | / ____ \|_|            ###
    ###          |_|  |_|\____/|_|/_/    \_\              ###
    ###                                                   ### 
    ######################################################### 

use_float32 set to True: replacing float64 arrays by float32 arrays to speed up computations...

Successfully loaded view='Microbial_pathways' group='single_group' with N=16 samples and D=363 features... Successfully loaded view='Microbial_Taxonomy' group='single_group' with N=16 samples and D=195 features... Successfully loaded view='RNA' group='single_group' with N=16 samples and D=14324 features...

Warning: 6860 features(s) in view 2 have zero variance, consider removing them before training the model...

Model options:

Error in py_call_impl(callable, call_args$unnamed, call_args$named) : AttributeError: Module 'scipy' has no attribute 'shape' Run reticulate::py_last_error() for details. In addition: Warning message: In run_mofa(mofa) : No output filename provided. Using /var/folders/3q/l3mk74214gb7n96bld12vg8h0000gn/T//RtmpQOMa72/mofa_20240326-142718.hdf5 to store the trained model.

Rana-Sabrii commented 3 months ago

Change s.shape to np.shape in the mofapy2/core/distributions/basic_distributions.py file and s.outer to np.outer in the mofapy2/core/BayesNet.py files.

nbutyrate commented 3 months ago

Thanks, it worked like magic, i have new error, please help

plot_weights_fn(mofa1, factor=1, view="Microbial_Taxonomy", nfeatures=8) Error in plot_weights_fn(mofa1, factor = 1, view = "Microbial_Taxonomy", : could not find function "plot_weights_fn"

packageVersion("MOFA2") [1] ‘1.13.0’

Rana-Sabrii commented 3 months ago

can you give me the source where you get the code from?

nbutyrate commented 3 months ago

I am trying to follow this

https://raw.githack.com/bioFAM/MOFA2_tutorials/master/R_tutorials/microbiome_vignette.html

Rana-Sabrii commented 3 months ago

I tried to do so but i faced the same error😂 push it as a new issue may someone knows help

artur-sannikov commented 3 months ago

The links you published are outdated. I guess, the function plot_weights_fn is now called plot_weights. I opened #148. There you will find the link to the latest reference manual. For latest tutorials, see Bioconductor page.

artur-sannikov commented 3 months ago

I opened #157 for outdated links to tutorials.