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

Error in py_call_impl(callable, dots$args, dots$keywords) #24

Closed
CarlBrunius opened this issue Jan 17, 2019 · 6 comments
Closed

Error in py_call_impl(callable, dots$args, dots$keywords) #24

CarlBrunius opened this issue Jan 17, 2019 · 6 comments

Comments

@CarlBrunius
Copy link

Hi,
New to MOFA and super excited to try it out :)

I am installing/running CLL tutorial for the 1st time. Must warn: I speak R pretty OK, but am a total python illiterate.

Installation of python part was nightmarish. Suggest easier installation tutorial (e.g. install pip like this; install python like this with links to such sites). Several error messages during installation. Googled for tips and tricks. Manual tweaks for installing python package dependencies. Added --user flag to most installation steps. Finally, exited installation without error messages

R installation however flawless.

Running thru CLL tutorial: All steps up to and including prepareMOFA() OK

When running MOFAobject <- runMOFA(MOFAobject) I get error message:

Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'list' object has no attribute 'copy'
In addition: Warning message:
In if (class(mofa) == "try-error") { :

With traceback:

4.
stop(structure(list(message = "AttributeError: 'list' object has no attribute 'copy'", 
    call = py_call_impl(callable, dots$args, dots$keywords), 
    cppstack = structure(list(file = "", line = -1L, stack = c("1   reticulate.so                       0x000000011fe89f9b _ZN4Rcpp9exceptionC2EPKcb + 219", 
    "2   reticulate.so                       0x000000011fe90a35 _ZN4Rcpp4stopERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 53",  ... 
3.
set_data at entry_point.py#90
2.
mofa_entrypoint$set_data(data = unname(lapply(object@TrainData, 
    function(x) r_to_py(t(x))))) 
1.
runMOFA(MOFAobject) 

I guess something not quite right with python installation anyway?

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] bindrcpp_0.2.2   MOFAtools_0.99.0

loaded via a namespace (and not attached):
 [1] SummarizedExperiment_1.12.0 reticulate_1.10             beeswarm_0.2.3             
 [4] tidyselect_0.2.5            corrplot_0.84               purrr_0.2.5                
 [7] reshape2_1.4.3              rhdf5_2.26.2                lattice_0.20-38            
[10] colorspace_1.4-0            stats4_3.5.1                yaml_2.2.0                 
[13] rlang_0.3.1                 pillar_1.3.1                glue_1.3.0                 
[16] BiocParallel_1.16.5         BiocGenerics_0.28.0         RColorBrewer_1.1-2         
[19] matrixStats_0.54.0          GenomeInfoDbData_1.2.0      foreach_1.4.4              
[22] bindr_0.1.1                 plyr_1.8.4                  stringr_1.3.1              
[25] zlibbioc_1.28.0             munsell_0.5.0               gtable_0.2.0               
[28] codetools_0.2-16            Biobase_2.42.0              IRanges_2.16.0             
[31] doParallel_1.0.14           MultiAssayExperiment_1.8.1  GenomeInfoDb_1.18.1        
[34] vipor_0.4.5                 parallel_3.5.1              Rcpp_1.0.0                 
[37] scales_1.0.0                DelayedArray_0.8.0          S4Vectors_0.20.1           
[40] jsonlite_1.6                XVector_0.22.0              ggplot2_3.1.0              
[43] stringi_1.2.4               dplyr_0.7.8                 ggrepel_0.8.0              
[46] cowplot_0.9.4               GenomicRanges_1.34.0        grid_3.5.1                 
[49] tools_3.5.1                 bitops_1.0-6                magrittr_1.5               
[52] RCurl_1.95-4.11             lazyeval_0.2.1              tibble_2.0.1               
[55] crayon_1.3.4                pkgconfig_2.0.2             pheatmap_1.0.12            
[58] Matrix_1.2-15               ggbeeswarm_0.6.0            assertthat_0.2.0           
[61] rstudioapi_0.9.0            iterators_1.0.10            Rhdf5lib_1.4.2             
[64] R6_2.3.0                    compiler_3.5.1     

Best wishes,
Carl

@rargelaguet
Copy link
Contributor

rargelaguet commented Jan 17, 2019

Hi Carl, Thanks for the feedback.
I uploaded the python package to pypi so it should be easier to install by pip install mofapy. I will update the README file now. Can you try if it works?

The error is a bug I actually introduced 30min ago. Can you pull the last commit and install again the R package?

Thanks!

@CarlBrunius
Copy link
Author

Hi, thx!

Terminal output from PyPI installation:

emp-235-92:~ carlbru$ pip install mofapy
Requirement already satisfied: mofapy in ./Library/Python/2.7/lib/python/site-packages (1.0)
Requirement already satisfied: pandas in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (0.23.4)
Requirement already satisfied: scipy in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (1.2.0)
Requirement already satisfied: numpy in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (1.16.0)
Requirement already satisfied: sklearn in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (0.0)
Requirement already satisfied: argparse in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (1.4.0)
Requirement already satisfied: h5py in ./Library/Python/2.7/lib/python/site-packages (from mofapy) (2.9.0)
Requirement already satisfied: pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas->mofapy) (2013.7)
Requirement already satisfied: python-dateutil>=2.5.0 in ./Library/Python/2.7/lib/python/site-packages (from pandas->mofapy) (2.7.5)
Requirement already satisfied: scikit-learn in ./Library/Python/2.7/lib/python/site-packages (from sklearn->mofapy) (0.20.2)
Requirement already satisfied: six in ./Library/Python/2.7/lib/python/site-packages (from h5py->mofapy) (1.12.0)

New pull of MOFA package (MOFAtools_0.99.0)

> devtools::install_github("bioFAM/MOFA", subdir="MOFAtools")
Downloading GitHub repo bioFAM/MOFA@master
Skipping 15 packages ahead of CRAN: Biobase, BiocGenerics, BiocParallel, DelayedArray, GenomeInfoDb, GenomeInfoDbData, GenomicRanges, IRanges, MultiAssayExperiment, rhdf5, Rhdf5lib, S4Vectors, SummarizedExperiment, XVector, zlibbioc
✔  checking for file ‘/private/var/folders/2r/zlfvsylj481_1f153mph_644b3ydvg/T/RtmpZ6a7f3/remotes5943dbf218d/bioFAM-MOFA-b310386/MOFAtools/DESCRIPTION’ ...
─  preparing ‘MOFAtools’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘MOFAtools_0.99.0.tar.gz’ (1.5s)
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'
   
* installing *source* package ‘MOFAtools’ ...
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (MOFAtools)
> MOFAobject <- runMOFA(MOFAobject)
[1] "No output file provided, using a temporary file..."

    ###########################################################
    ###                 __  __  ___  _____ _                ### 
    ###                |  \/  |/ _ \|  ___/ \               ### 
    ###                | |\/| | | | | |_ / _ \              ### 
    ###                | |  | | |_| |  _/ ___ \             ### 
    ###                |_|  |_|\___/|_|/_/   \_\            ### 
    ###                                                     ###
    ########################################################### 
   
 
    
Loaded view 0 with 200 samples and 310 features...
Loaded view 1 with 200 samples and 4248 features...
Loaded view 2 with 200 samples and 5000 features...
Loaded view 3 with 200 samples and 69 features...

##############################################
## Doing sanity checks and parsing the data ##
##############################################

Error in py_call_impl(callable, dots$args, dots$keywords) : 
  AttributeError: 'list' object has no attribute 'copy' 
4.
stop(structure(list(message = "AttributeError: 'list' object has no attribute 'copy'", 
    call = py_call_impl(callable, dots$args, dots$keywords), 
    cppstack = structure(list(file = "", line = -1L, stack = c("1   reticulate.so                       0x0000000121bb9f9b _ZN4Rcpp9exceptionC2EPKcb + 219", 
    "2   reticulate.so                       0x0000000121bc0a35 _ZN4Rcpp4stopERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 53",  ... 
3.
set_data at entry_point.py#90
2.
mofa_entrypoint$set_data(data = unname(lapply(object@TrainData, 
    function(x) r_to_py(t(x))))) 
1.

@rargelaguet
Copy link
Contributor

rargelaguet commented Jan 17, 2019

Could you re-install the python package from github and try again?

@CarlBrunius
Copy link
Author

Let me get back to you in a few hours...

@CarlBrunius
Copy link
Author

python installation using pip install git+git://github.com/bioFAM/MOFA --upgrade -> Rolling back uninstall of mofapy

However, with the --user flag -> success :)

carlbru$ pip install git+git://github.com/bioFAM/MOFA --upgrade --user
Collecting git+git://github.com/bioFAM/MOFA
  Cloning git://github.com/bioFAM/MOFA to /private/var/folders/2r/zlfvsylj481_1f153mph_644b3ydvg/T/pip-req-build-6KatHF
Requirement already satisfied, skipping upgrade: pandas in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (0.23.4)
Requirement already satisfied, skipping upgrade: scipy in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (1.2.0)
Requirement already satisfied, skipping upgrade: numpy in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (1.16.0)
Requirement already satisfied, skipping upgrade: sklearn in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (0.0)
Requirement already satisfied, skipping upgrade: argparse in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (1.4.0)
Requirement already satisfied, skipping upgrade: h5py in ./Library/Python/2.7/lib/python/site-packages (from mofapy==1.1) (2.9.0)
Requirement already satisfied, skipping upgrade: pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas->mofapy==1.1) (2013.7)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.5.0 in ./Library/Python/2.7/lib/python/site-packages (from pandas->mofapy==1.1) (2.7.5)
Requirement already satisfied, skipping upgrade: scikit-learn in ./Library/Python/2.7/lib/python/site-packages (from sklearn->mofapy==1.1) (0.20.2)
Requirement already satisfied, skipping upgrade: six in ./Library/Python/2.7/lib/python/site-packages (from h5py->mofapy==1.1) (1.12.0)
Installing collected packages: mofapy
  Found existing installation: mofapy 1.0
    Uninstalling mofapy-1.0:
      Successfully uninstalled mofapy-1.0
  Running setup.py install for mofapy ... done
Successfully installed mofapy-1.1

RunMOFA() now seems to work:

...
Iteration 1227: time=0.40 ELBO=-3129248.31, deltaELBO=0.0996, Factors=10
Converged!



###########################################
## Training finished, processing results ##
###########################################

@rargelaguet
Copy link
Contributor

Great, thanks for the confirmation.
If you want personalised help on interpreting your model, don't hesitate to reach me via the Slack channel

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

2 participants