Sage-Bionetworks / synapser

An R package providing programmatic access to Synapse
Apache License 2.0
32 stars 21 forks source link

PATH and RETICULATE_PATH are ignored when setting up Python virtual environment #327

Closed pvo93 closed 2 weeks ago

pvo93 commented 10 months ago

Operating system

Linux RHEL8 in a shared research high performance computing environment (Mayo Clinic) where I don't have root privileges.

Description of the problem

When I try to install synapser, it always uses /usr/bin/python2.7 even though that's not the python in my PATH or RETICULATE_PATH. This leads to multiple warnings that 2.7 is deprecated. Then the installation fails because it can't find a recent enough version of pandas. Even after I hack the code to get around that, it can't install the python client version 3.0.0 as specified in your installPythonClient.R file.

Expected behavior

I expect it to use the python specified in PATH or RETICULATE_PATH

Actual behavior

[wa02042@mforgehn4 synapser]$ R --vanilla

R version 4.2.2 (2022-10-31) -- "Innocent and Trusting" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.

.libPaths("/usr/local/biotools/rpackages/R-4.2.2-2023-02-01") system("which python") /usr/local/biotools/python/3.10.7/bin/python system("\rm -rf ~/.virtualenvs/r-reticulate") install.packages("synapser", repos = c("http://ran.synapse.org", "http://cran.fhcrc.org")) Installing package into ‘/usr/local/biotools/rpackages/R-4.2.2-2023-02-01’ (as ‘lib’ is unspecified) trying URL 'http://ran.synapse.org/src/contrib/synapser_1.2.0.143.tar.gz' Content type 'application/x-tar' length 156600 bytes (152 KB)

downloaded 152 KB

The downloaded source packages are in ‘/tmp/RtmpE09Aui/downloaded_packages’ Warning message: In install.packages("synapser", repos = c("http://ran.synapse.org", : installation of package ‘synapser’ had non-zero exit status

Output of sessionInfo()

sessionInfo() R version 4.2.2 (2022-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.8 (Ootpa)

Matrix products: default BLAS: /usr/lib64/libblas.so.3.8.0 LAPACK: /usr/lib64/liblapack.so.3.8.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
[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

loaded via a namespace (and not attached): [1] compiler_4.2.2 tools_4.2.2

thomasyu888 commented 10 months ago

HI @pvo93 ,

Thanks for using synapser. Can you try doing this:

require(reticulate)
reticulate::use_python("/usr/local/biotools/python/3.10.7/bin/python")
install.packages("synapser", repos = c("http://ran.synapse.org/", "http://cran.fhcrc.org/"))
pvo93 commented 10 months ago

It still seems to be looking for Python 2.7 libraries.

require(reticulate) Loading required package: reticulate install.packages("synapser", repos = c("http://ran.synapse.org/", "http://cran.fhcrc.org/")) Installing package into ‘/usr/local/biotools/rpackages/R-4.2.2-2023-02-01’ (as ‘lib’ is unspecified) trying URL 'http://ran.synapse.org/src/contrib/synapser_1.2.0.143.tar.gz' Content type 'application/x-tar' length 156600 bytes (152 KB)

downloaded 152 KB

The downloaded source packages are in ‘/tmp/RtmpE09Aui/downloaded_packages’ Warning message: In install.packages("synapser", repos = c("http://ran.synapse.org/", : installation of package ‘synapser’ had non-zero exit status

thomasyu888 commented 10 months ago

HI @pvo93

Did you run this command before installing?

reticulate::use_python("/usr/local/biotools/python/3.10.7/bin/python")
pvo93 commented 10 months ago

Yes, I did. I ran it a second time after deleting ~/.virtualenvs/r-reticulate and forgot to include that line to paste in the output, but I had run it earlier in the session. My apologies. I just ran it again in a new session.

require(reticulate) Loading required package: reticulate reticulate::use_python("/usr/local/biotools/python/3.10.7/bin/python") install.packages("synapser", repos = c("http://ran.synapse.org/", "http://cran.fhcrc.org/")) Installing package into ‘/usr/local/biotools/rpackages/R-4.2.2-2023-02-01’ (as ‘lib’ is unspecified) trying URL 'http://ran.synapse.org/src/contrib/synapser_1.2.0.143.tar.gz' Content type 'application/x-tar' length 156600 bytes (152 KB)

downloaded 152 KB

The downloaded source packages are in ‘/tmp/RtmpJvldw0/downloaded_packages’ Warning message: In install.packages("synapser", repos = c("http://ran.synapse.org/", : installation of package ‘synapser’ had non-zero exit status

thomasyu888 commented 9 months ago

Hi @pvo93 ,

Apologies for the delays in response - I have found the bug and am attempting to fix it for the upcoming release. In the meantime, a not as ideal way to interact with the client in R can be found here: https://github.com/Sage-Bionetworks/synapsePythonClient/blob/develop/docs/articles/reticulate.rst.

You would use reticulate directly to install the client:

require(reticulate)
reticulate::use_python("/usr/local/biotools/python/3.10.7/bin/python")
reticulate::py_install("synapseclient")

The rest of the instructions can be found in the link above. Please let me know if that doesn't work while I attempt to fix the issue.

thomasyu888 commented 2 weeks ago

The new versions of the client should have this fixed! closing for now