Skip to content

[DOCUMENTATION] Detailed installation instructions for non-conda users #75

@AnthonyOfSeattle

Description

@AnthonyOfSeattle

NOT BLOCKING FOR PUBLICATION

This request is very specific to my situation. The current miniconda installation instructions were very straight forward and I was able to create this Dockerfile to give me an environment for testing.

FROM rocker/r-ver:4.4

RUN R -e "install.packages('reticulate')"
RUN R -e "reticulate::install_miniconda()"

RUN R -e "install.packages('BiocManager')"
RUN R -e "BiocManager::install(version = '3.20')"

RUN R -e "install.packages('remotes')"
RUN R -e "BiocManager::install('RforMassSpectrometry/ProtGenerics', ask=F)"
RUN R -e "BiocManager::install('RforMassSpectrometry/Spectra', ask=F)"
RUN R -e "BiocManager::install('RforMassSpectrometry/SpectriPy', ask=F)"

RUN R -e "install.packages('testthat')"

However, I have a second weird situation. Due to commercial restrictions, I am unable to use miniconda at work. So I was looking for some detailed instructions on how to setup the package using virtualenv instead. I found the toggle between the two setups in the code chunk bellow,

SpectriPy/R/zzz.R

Lines 68 to 98 in c823e95

.install_python_packages <- function(envname = .spectripy_env(),
use_conda = .spectripy_use_conda(), ...) {
if (!py_module_available("matchms")) {
packageStartupMessage("Installing required 'matchms' library")
if (use_conda) {
py_install(c("matchms==0.28.2"),
envname = envname, method = "conda", pip = FALSE,
channel = c("bioconda", "conda-forge"), ...)
} else {
py_install(c("matchms==0.28.2", "numpy==2.0.2"),
envname = envname, method = "virtualenv",
channel = c("conda-forge"), ...)
}
packageStartupMessage(
"\nPlease restart R to load the freshly installed packages.\n")
}
if (!py_module_available("spectrum_utils")) {
packageStartupMessage("Installing required 'spectrum_utils' library")
if (use_conda) {
py_install(c("spectrum_utils==0.3.2"),
envname = envname, method = "conda", pip = FALSE,
channel = c("bioconda", "conda-forge"), ...)
} else {
py_install(c("spectrum_utils==0.3.2", "numpy==2.0.2"),
envname = envname, method = "virtualenv",
channel = c("conda-forge"), ...)
}
packageStartupMessage(
"\nPlease restart R to load the freshly installed packages.\n")
}
}

And I was able to find a reference to an the R variable that I needed to set here

SpectriPy/R/zzz.R

Lines 55 to 59 in c823e95

.spectripy_use_conda <- function() {
as.logical(getOption(
"spectripy.use_conda",
Sys.getenv("SPECTRIPY_USE_CONDA", unset = "TRUE")))
}

But I couldn't seem to get all the way through tests. Could these instructions be added to the Documentation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions