Closed wewen1996 closed 1 year ago
Thanks @wewen1996 for using synapser
. Are you using Rstudio to install synapser
? if so, can you try following the steps below
Can you try the following. I am on a mac.
Go to Tools -> Project Options (or Global Options)
Click the Python tab:
Set the Python interpreter to use one of the virtual environments
Re-install synapser
. This should work, but please let me know if this doesn't work.
Thank you very much. I successfully ran the synapser package through your method. Thank you very much for helping me solve the problem.
FYI, in general this still occurs for me in both Rstudio and R CLI instances on my cluster. When loading the package it prompts a rebuild of the reticulate
virtualenv environment:
> library(synapser)
Using virtual environment '~/.virtualenvs/r-reticulate' ...
+ '/home/rrbutler/.virtualenvs/r-reticulate/bin/python' -m pip install --upgrade --no-user 'requests' 'pandas' 'pysftp' 'jinja2' 'markupsafe'
Requirement already satisfied: requests in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (2.31.0)
Requirement already satisfied: pandas in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (2.0.2)
Requirement already satisfied: pysftp in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (0.2.9)
...
Using virtual environment '~/.virtualenvs/r-reticulate' ...
+ '/home/rrbutler/.virtualenvs/r-reticulate/bin/python' -m pip install --upgrade --no-user 'synapseclient==2.7.0'
Requirement already satisfied: synapseclient==2.7.0 in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (2.7.0)
Requirement already satisfied: requests<3.0,>=2.22.0 in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (from synapseclient==2.7.0) (2.31.0)
...
Requirement already satisfied: pycparser in ./.virtualenvs/r-reticulate/lib/python3.11/site-packages (from cffi>=1.12->cryptography>=2.0->SecretStorage>=3.2->keyring<23.5,>=15->synapseclient==2.7.0) (2.21)
Error: package or namespace load failed for ‘synapser’:
.onLoad failed in loadNamespace() for 'synapser', details:
call: NULL
error: ModuleNotFoundError: No module named 'synapseclient'
I am guessing this may be a python 3.11
compatibility issue. The client is locked at synapseclient==2.7.0
and if you try to exit and install it directly it cannot find 2.7.0
:
~$ ~/.virtualenvs/r-reticulate/bin/python -m pip install --upgrade --no-user synapseclient-2.7.0
ERROR: Could not find a version that satisfies the requirement synapseclient-2.7.0 (from versions: none)
ERROR: No matching distribution found for synapseclient-2.7.0
but it installs 2.7.2
without issue. However, when you then try to load the synapser
library it uninstalls it:
library(synapser)
...
Installing collected packages: synapseclient
Attempting uninstall: synapseclient
Found existing installation: synapseclient 2.7.2
Uninstalling synapseclient-2.7.2:
Successfully uninstalled synapseclient-2.7.2
Successfully installed synapseclient-2.7.0
Error: package or namespace load failed for ‘synapser’:
.onLoad failed in loadNamespace() for 'synapser', details:
call: NULL
error: ModuleNotFoundError: No module named 'synapseclient'
In terms of solutions, even though it gives an error, synapseclient==2.7.0
is actually there. For CLI you have to then specify RETICULATE_PYTHON
path every time prior to attempting to load the library (otherwise quit and restart R):
> Sys.setenv(RETICULATE_PYTHON = "~/.virtualenvs/r-reticulate/bin/python")
> library(synapser)
For Rstudio it is the solution specified above works, but in either case something about the reticulate build is not checking out (or ideally it would check for the existing virtualenv path first and skip building altogether).
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.3.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] 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] synapser_1.0.59
loaded via a namespace (and not attached):
[1] compiler_4.2.2 rjson_0.2.21 Matrix_1.5-4.1 tools_4.2.2
[5] Rcpp_1.0.10 reticulate_1.28 codetools_0.2-19 grid_4.2.2
[9] jsonlite_1.8.4 png_0.1-8 lattice_0.21-8
Thanks for reporting this issue! I will look into this soon.
@rbutleriii This branch: https://github.com/Sage-Bionetworks/synapser/pull/318 potentially fixes this. Could you check for me?
remotes::install_git("https://github.com/Sage-Bionetworks/synapser", ref="update-client-version")
I do have to push the above release either way.
I am a freshman in Synapser and have followed the steps on the Sage Bionetworks R Archive Network (http://ran.synapse.org/) to install the Synapser client. However, I am still encountering an error in R (4.2.3) as follows: Error: package or namespace load failed for ‘synapser’: .onLoad failed in loadNamespace() for 'synapser', details: call: py_run_string_impl(code, local, convert) error: ModuleNotFoundError: No module named 'synapseclient' I have tried reinstalling different versions of R but have not been able to solve the problem. My R version is 4.2.3 and my system is macOS Ventura 13.0 on a MacBook Air (M2, 2022).
Then I follow your suggestion and set the Go to Tools -> Project Options (or Global Options)
And the R reported annother error: `error: ImportError: dlopen(/Users/renee/.virtualenvs/r-reticulate/lib/python3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so, 0x0002): tried: '/Users/renee/.virtualenvs/r-reticulate/lib/python3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/renee/.virtualenvs/r-reticulate/lib/python3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so' (no such file), '/Users/lrenee/.virtualenvs/r-reticulate/lib/python3.9/site-packages/charset_normalizer/md.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
and I run the reticulate::py_last_error()
for details.
My question may be disorganized,I hope I have expressed my difficulties clearly. Thank you.
Thanks @YanranLee007 for filing this issue! I will take a look - apologies for the troubles!
Thanks @thomasyu888 , I feel sorry to bottor you again, I change my system to windows to install synapser. And I faced another problem. my working environment: R version 4.2.2 (2022-10-31 ucrt) -- "Innocent and Trusting" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)
I first install the synapser I try the link http://ran.synapse.org/bin/windows/contrib/4.2/synapser_1.0.59.zip and download the synapser_1.0.59.zip
Although I can log in now. The library synapserutils is still not availiable to download.
Could you give me a hand to install synapser in R and download the files? Either is OK in win or mac. Thanks
@YanranLee007 Thanks for filing the issue. It seems you're able to install synapser
now, but you need to install synapserutils
separately.
Currently the installation instructions found here are out of date. but you will need to do:
remotes::install_git("https://github.com/Sage-Bionetworks/synapserutils")
Operating system
Description of the problem
Expected behavior
*I hope I can library this package successfully.
Actual behavior
*Error: package or namespace load failed for ‘synapser’: loadNamespace()里算'synapser'时.onLoad失败了,详细内容: 调用: NULL 错误: ModuleNotFoundError: No module named 'synapseclient'
Output of
sessionInfo()
*R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale: [1] LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8 LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.utf8
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached): [1] reticulate_1.28 xfun_0.36 remotes_2.4.2 purrr_1.0.0 lattice_0.20-45 vctrs_0.5.1 miniUI_0.1.1.1 htmltools_0.5.4 usethis_2.1.6
[10] yaml_2.3.6 rlang_1.0.6 pkgbuild_1.4.0 later_1.3.0 urlchecker_1.0.1 glue_1.6.2 sessioninfo_1.2.2 lifecycle_1.0.3 stringr_1.5.0
[19] devtools_2.4.5 htmlwidgets_1.6.0 memoise_2.0.1 evaluate_0.19 knitr_1.42 callr_3.7.3 fastmap_1.1.0 httpuv_1.6.7 ps_1.7.2
[28] Rcpp_1.0.9 xtable_1.8-4 promises_1.2.0.1 BiocManager_1.30.19 cachem_1.0.6 pkgload_1.3.2 jsonlite_1.8.4 mime_0.12 fs_1.5.2
[37] rjson_0.2.21 png_0.1-8 digest_0.6.31 stringi_1.7.8 processx_3.8.0 shiny_1.7.4 grid_4.2.2 rprojroot_2.0.3 here_1.0.1
[46] cli_3.4.1 tools_4.2.2 magrittr_2.0.3 profvis_0.3.7 crayon_1.5.2 ellipsis_0.3.2 Matrix_1.5-3 rsconnect_0.8.28 prettyunits_1.1.1
[55] rmarkdown_2.19 rstudioapi_0.14 R6_2.5.1 compiler_4.2.2