Closed dfermin closed 4 years ago
I've been trying to debug this and found this inconsistency. I don't know if it will help
When I try to access the data in the mofa.core
module from within R I cannot see any of the functions:
> library(reticulate)
> use_condaenv(condaenv="py36", required=TRUE)
> mofa <- import("mofapy")
> py_list_attributes(mofa$core)
[1] "__builtins__" "__cached__" "__doc__" "__file__"
[5] "__loader__" "__name__" "__package__" "__path__" "__spec__"
> dir("/home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/mofapy/core")
[1] "__init__.py" "__pycache__" "BayesNet.py" "build_model.py"
[5] "distributions.py" "entry_point.py" "init_nodes.py" "mixed_nodes.py"
[8] "multiview_nodes.py" "nodes.py" "nongaussian_nodes.py" "simulate.py"
[12] "updates.py" "utils.py" "variational_nodes.py"
If I load a different python module the functions are visible and correspond to the python scripts for the module:
> vcf <- import("vcf") ## importing the PyVCF module
> py_list_attributes(vcf)
[1] "Filter" "RESERVED_FORMAT" "RESERVED_INFO" "Reader"
[5] "SampleFilter" "VCFReader" "VCFWriter" "VERSION"
[9] "Writer" "__builtins__" "__cached__" "__doc__"
[13] "__file__" "__loader__" "__name__" "__package__"
[17] "__path__" "__spec__" "filters" "model"
[21] "parser" "sample_filter"
>dir("home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/vcf/")
[1] "__init__.py" "__pycache__" "cparse.pyx" "filters.py"
[5] "model.py" "parser.py" "sample_filter.py" "test"
[9] "utils.py"
If I switch over to python I have the same error that I observe in R:
$ conda activate py36
$ python
>>> from mofapy import core
>>> core
<module 'mofapy.core' from '/home/dfermin/anaconda3/envs/py36/lib/python3.6/site-packages/mofapy/core/__init__.py'>
>>> core.entry_point
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'mofapy.core' has no attribute 'entry_point'
This doesn't happen with the vcf module I tested earlier.
I don't know if this is because the vcf module doesn't contain a core
subdirectory or not but I thought someone with a better understanding of python might be able to suggest a fix.
if somebody is still interested: I had the same problem when installing mofapy directly in my conda-environment. After a long trial and error an installation from R helped to solve the problem, but I still do not know why:
run in R:
library(reticulate)
py_install("mofapy", envname = "mofa_env", method="conda",
conda = "/opt/anaconda/3-5.0.1/bin/conda", pip=TRUE)
additionally restart the R session afterwards
I had the same issue running MOFA2 on RStudio Server. The error message said also: "AttributeError: module 'mofapy' has no attribute 'core.entry_point'" I noticed that r-reticulate generated a conda env by itself.
So, I did not changed the conda_env for my MOFA run and installed mofapy2 by first accessing the r-reticulate env: conda activate /home/XXX/.local/share/r-miniconda/envs/r-reticulate
And install mofapy2: pip install mofapy2
That solved the problem for me. Hope it is helpful.
Been running into this as well today, and I found the following helpful to debug (using MOFA2 and use_basilisk=FALSE
):
reticulate::py_config()
which python installation is usedfrom mofapy2.run import entry_point
The error message you get will be more helpful than what run_mofa
displays
Hi
This is a weird problem. I've installed MOFA and I'm trying to work through the CLL example but can't execute the
runMOFA(MOFAObject)
command.I keep getting this error:
I'm using an Anaconda environment running Python 3.6. It seems that
reticulate
has detected the correct instance and sees themofapy
package:When I go to the site-packages directory I see mofapy and the entry_point.py script is there:
I can import the library in python without any issues. I'm not using Rstudio, this is all on the terminal on an instance of RHEL. I've tried multiple versions of R and I'm currently using a freshly compiled version of 3.6.1. Does anyone have a suggestion for a work around?
The R sessionInfo outptu is given below in case it helps.