bioFAM / MOFA

Multi-Omics Factor Analysis
GNU Lesser General Public License v3.0
231 stars 57 forks source link

Error in py_get_attr_impl(x, name, silent) : AttributeError: module 'mofapy' has no attribute 'core.entry_point' #30

Closed ulexis99 closed 5 years ago

ulexis99 commented 5 years ago

Hi,

I know that someone else already posted a similar issue and got his issue answered by you. I am posting mine because I tried to resolve the issue as suggested, but my attempt was not successful. I appreciate any of your help.

Let me explain what I did.

Then, I try to test MOFA on the CLL data as follows.

data("CLL_data") MOFAobject <- createMOFAobject(CLL_data)

DataOptions <- getDefaultDataOptions()

ModelOptions <- getDefaultModelOptions(MOFAobject) ModelOptions$numFactors <- 50

TrainOptions <- getDefaultTrainOptions()

TrainOptions$DropFactorThreshold <- 0.02 TrainOptions$seed <- 2017 TrainOptions$tolerance <- 0.01

MOFAobject <- prepareMOFA(MOFAobject, DataOptions = DataOptions, ModelOptions = ModelOptions, TrainOptions = TrainOptions)

MOFAobject <- runMOFA(MOFAobject) [1] "No output file provided, using a temporary file..." Error in py_get_attr_impl(x, name, silent) : AttributeError: module 'mofapy' has no attribute 'core.entry_point'

Interestingly, when I run import("mofapy"), no errors were returned; thus, mofapy is actually imported. Do you have any idea or comment on the issue that I have?

Thank you!

Gene

rargelaguet commented 5 years ago

Definitely looks good, and running the same exact code in my laptop works. Sometimes a problem is that Rstudio needs to be restarted after installing mofapy package. Did you do this?

Also, can you check that the following folder contains entry_point.py? ~/bin/python/envs/env_MOFA/lib/python3.6/site-packages/mofapy/core

ulexis99 commented 5 years ago

Thank you for your reply!

First, yes I restarted Rstudio after installing mofapy, because I read a similar suggestion from another thread of Q&A. Also, I installed another R to test if the above code works on it, but I got the same error.

Next, I checked ~/bin/python/envs/env_MOFA/lib/python3.6/site-packages/mofapy/core as you suggested and I found that entry_point.py is there. Please have a look at the following ls result.

I would thank you for any more suggestions!

Gene

~/bin/python/envs/env_MOFA/lib/python3.6/site-packages/mofapy/core$ ls -1 BayesNet.py build_model.py distributions.py entry_point.py init_nodes.py init.py mixed_nodes.py multiview_nodes.py nodes.py nongaussian_nodes.py pycache simulate.py updates.py utils.py variational_nodes.py

ulexis99 commented 5 years ago

I think that I've got this issue resolved. I set up another Rstudio in a different cloud platform and I could pass the step that I had stumbled on previously.

However, I have another error when I was running runMOFA. I will create another issue.

dfermin commented 4 years ago

Sorry to revive this issue but I'm having this same error. Restarting R doesn't help. I'm not using RStudio just the command line on RHEL 7.

Here is my check of the python code:

> library(MOFA)
> library(MOFAdata)
> library(reticulate)
> use_condaenv(condaenv="py36", required=TRUE)
> py_config()
python:         /home/dfermin/anaconda3/envs/py36/bin/python
libpython:      /home/dfermin/anaconda3/envs/py36/lib/libpython3.6m.so
pythonhome:     /home/dfermin/anaconda3/envs/py36:/home/dfermin/anaconda3/envs/py36
version:        3.6.7 | packaged by conda-forge | (default, Jul  2 2019, 02:18:42)  [GCC 7.3.0]
numpy:          /home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/numpy
numpy_version:  1.17.0

NOTE: Python version was forced by use_python function

Everything works fine until I try to run MOFA:

MOFAObject <- runMOFA(MOFAObject)
Error in py_get_attr_impl(x, name, silent) :
  AttributeError: module 'mofapy' has no attribute 'core.entry_point'

Any suggestions what I can do to fix this?

Here is my session info in case it helps:

R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Workstation 7.7 (Maipo)

Matrix products: default
BLAS: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/3.5.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] reticulate_1.12      MOFAdata_1.1.0       MOFA_1.1.1           RevoUtils_11.0.3     nvimcom_0.9-83       RevoUtilsMath_11.0.0

loaded via a namespace (and not attached):
 [1] SummarizedExperiment_1.12.0 beeswarm_0.2.3              tidyselect_0.2.5            corrplot_0.84               purrr_0.3.3                 reshape2_1.4.3              rhdf5_2.26.2                lattice_0.20-38             colorspace_1.4-1
[10] stats4_3.5.3                rlang_0.4.1                 pillar_1.4.2                glue_1.3.1                  BiocParallel_1.16.6         BiocGenerics_0.28.0         RColorBrewer_1.1-2          matrixStats_0.54.0          GenomeInfoDbData_1.2.0
[19] foreach_1.5.1               plyr_1.8.4                  stringr_1.4.0               zlibbioc_1.28.0             munsell_0.5.0               gtable_0.3.0                codetools_0.2-16            Biobase_2.42.0              IRanges_2.16.0
[28] doParallel_1.0.15           MultiAssayExperiment_1.8.3  GenomeInfoDb_1.18.2         vipor_0.4.5                 parallel_3.5.3              Rcpp_1.0.2                  scales_1.0.0                DelayedArray_0.8.0          S4Vectors_0.20.1
[37] jsonlite_1.6                XVector_0.22.0              ggplot2_3.2.1               stringi_1.4.3               dplyr_0.8.3                 ggrepel_0.8.0               cowplot_0.9.4               GenomicRanges_1.34.0        grid_3.5.3
[46] tools_3.5.3                 bitops_1.0-6                magrittr_1.5                RCurl_1.95-4.12             lazyeval_0.2.2              tibble_2.1.3                crayon_1.3.4                pkgconfig_2.0.3             pheatmap_1.0.12
[55] Matrix_1.2-17               ggbeeswarm_0.6.0            assertthat_0.2.1            iterators_1.0.12            Rhdf5lib_1.4.3              R6_2.4.0                    compiler_3.5.3
rargelaguet commented 4 years ago

Hi Damian, everything looks good. Are you pointing to the right python executable? Try doing import mofapy in the python terminal that you are pointing to (/home/dfermin/anaconda3/envs/py36/bin/python). If it doesn't work, can you contact me via the Slack channel (link in the README)? We will need an interactive chat to debug this

dfermin commented 4 years ago

Okay I can get it to run with two changes: First I need to use R 3.6.0 Second I need to use use_python("/home/dfermin/anaconda3/envs/py36/bin/python", required=TRUE).

I'm not sure what's different between the 2 versions of R but things go without a hitch using 3.6

Thanks!

dfermin commented 4 years ago

Okay... Spoke too soon. After exiting out of R and restarting it I get back to the same error:

> py_config()
python:         /home/dfermin/anaconda3/envs/py36/bin/python
libpython:      /home/dfermin/anaconda3/envs/py36/lib/libpython3.6m.so
pythonhome:     /home/dfermin/anaconda3/envs/py36:/home/dfermin/anaconda3/envs/py36
version:        3.6.7 | packaged by conda-forge | (default, Jul  2 2019, 02:18:42)  [GCC 7.3.0]
numpy:          /home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/numpy
numpy_version:  1.17.0
mofapy:         /home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/mofapy

> MOFAObject <- prepareMOFA(
+   MOFAObject,
+   DataOptions=DataOptions,
+   ModelOptions=ModelOptions,
+   TrainOptions=TrainOptions)
Checking data options...
Checking training options...
Checking model options...
> MOFAObject <- runMOFA(MOFAObject)
[1] "No output file provided, using a temporary file..."
Error in py_get_attr_impl(x, name, silent) :
  AttributeError: module 'mofapy' has no attribute 'core.entry_point'

Is there anyway to debug this on my end?

Damian