Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nbutyrate opened this issue Mar 26, 2024 · 7 comments
Open

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

nbutyrate opened this issue Mar 26, 2024 · 7 comments

Comments

@nbutyrate
Copy link

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:

  • Automatic Relevance Determination prior on the factors: False
  • Automatic Relevance Determination prior on the weights: True
  • Spike-and-slab prior on the factors: False
  • Spike-and-slab prior on the weights: False
    Likelihoods:
  • View 0 (Microbial_pathways): gaussian
  • View 1 (Microbial_Taxonomy): gaussian
  • View 2 (RNA): gaussian

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
Copy link

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
Copy link
Author

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
Copy link

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

@nbutyrate
Copy link
Author

@Rana-Sabrii
Copy link

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

@artur-sannikov
Copy link

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
Copy link

I opened #157 for outdated links to tutorials.

maximilian-heeg added a commit to maximilian-heeg/mofapy2 that referenced this issue Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants