How to download DESeq2 in miniconda3 environment? - r

I created an environment using miniconda3 with the following commands:
conda create -n r_ngs r-essentials r-base
source activate r_ngs
I needed to download some extra packages and I managed to download biomart and tximport with the following commands.
conda install -c bioconda bioconductor-tximport
conda install -c bioconda bioconductor-biomart
However, then I tried to install DESeq2 but I am getting errors. The command and errors are shown below.
conda install -c bioconda bioconductor-deseq2
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages. failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package libgcc-ng conflicts for:
bioconductor-deseq2 -> libgcc-ng[version='>=10.3.0|>=12|>=9.4.0|>=9.3.0|>=7.5.0|>=7.3.0|>=4.9']
bioconductor-deseq2 -> r-base[version='>=4.2,<4.3.0a0'] -> libgcc-ng[version='7.2.0.*|>=11.2.0|>=7.2.0']
Package libstdcxx-ng conflicts for:
bioconductor-deseq2 -> r-base[version='>=4.2,<4.3.0a0'] -> libstdcxx-ng[version='7.2.0.*|>=11.2.0|>=7.2.0']
bioconductor-deseq2 -> libstdcxx-ng[version='>=10.3.0|>=12|>=9.4.0|>=9.3.0|>=7.5.0|>=7.3.0|>=4.9']
Package xz conflicts for:
python=3.10 -> xz[version='>=5.2.5,<6.0a0|>=5.2.6,<6.0a0']
bioconductor-deseq2 -> r-base[version='>=4.2,<4.3.0a0'] -> xz[version='5.2.*|>=5.2.4,<6.0a0|>=5.2.5,<6.0a0']The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.35=0
- feature:|#/linux-64::__glibc==2.35=0
- python=3.10 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
Your installed version is: 2.35
The R version I have in the environment is R version 3.6.1 (2019-07-05).
How can I fix this?
Thank you

Bioconda has very specific channel requirements, namely:
conda-forge > bioconda > defaults
The best way to manage Conda environments is with YAMLs. One to use DESeq2 might look something like:
r_ngs.yaml
name: r_ngs
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=4.2
- bioconductor-deseq2
## additional packages...
and create it with
conda env create -n r_ngs -f r_ngs.yaml
Note, it is almost always preferable to declare all dependencies at time of creation of the environment.

Related

Trying to install via conda error (feature:/linux-64::__glibc==2.17=0 - r-exomedepth -> libgfortran-ng -> __glibc[version='>=2.17'] )

I'm trying to install exomedepth via conda on HPC. I have done this so far:
module load anaconda
source activate
conda create --name exomedepthcalling
conda activate exomedepthcalling
conda install -c bioconda r-exomedepth
But I get this error:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.17=0
- r-exomedepth -> libgfortran-ng -> __glibc[version='>=2.17']
Your installed version is: 2.17
I am not sure what this means or how to fix it, does anyone have any ideas? Thanks! Amy

R fails to load igraph in conda environment

I am trying to run an RShiny app in a WSL2 installation of Ubuntu on Windows. I am no expert in R, but I feel this is a problem due to conda interaction with R. I run the following commands:
conda create -n r_env r-essentials r-base
conda activate r_env
conda install -c conda-forge r-shiny
conda install -c r r-visnetwork
conda install -c conda-forge r-dplyr
conda install -c r r-dt
conda install -c conda-forge r-igraph
conda install -c r r-leaflet
conda install -c conda-forge r-rgdal
conda install -c r r-shinydashboard
conda install -c conda-forge r-shinywidgets
conda install -c conda-forge r-shinycssloaders
conda install -c conda-forge r-igraph
When I run R and type in : library(igraph) i get:
->Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so':
but I can list it, it's there:
ll /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
-> -rwxrwxr-x 1 carlo carlo 3816608 Mar 31 15:38 /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
Did anybody encounter a similar problem?
The igraph library was meant to load correctly
(My Opinion) I would caution against the use of the r channel and the r-essentials package. The Continuum/Anaconda support for R was a good college-try, but is since outmoded and superseded by the broader CRAN support that Conda Forge provides. Users managing R environments will find a better experience ignoring any Continuum/Anaconda documentation and exclusively using Conda Forge for their R environments. (End Opinion)
Mixing channels can lead to symbol reference errors. Furthermore, sequences of ad hoc installations are subpar - instead specify through a YAML.
The following YAML file works just fine on linux-64, osx-64, and win-64 platforms:
so-igraph.yaml
name: so-igraph
channels:
- conda-forge
dependencies:
- r-base=4.1 # adjust to desired version
- r-shiny
- r-visnetwork
- r-dplyr
- r-dt
- r-igraph
- r-leaflet
- r-rgdal
- r-shinydashboard
- r-shinywidgets
- r-shinycssloaders
- r-igraph
Which can be used with
conda env create -n so-igraph -f so-igraph.yaml
conda activate so-igraph
I was having a similar problem with R on AlmaLinux, and it turned out I was missing some libraries on the OS itself, which I thought I had and that were necessary for some R packages. I think they were these, which makes sense, given that we're talking about igraph, a graphing package:
gsl-devel-2.5-1.el8.x86_64
gsl-2.5-1.el8.x86_64
openssl-1.1.1k-6.el8_5.x86_64
geos-devel-3.7.2-1.el8.x86_64
geos-3.7.2-1.el8.x86_64
proj-datumgrid-1.8-6.3.2.4.el8.noarch
proj-6.3.2-4.el8.x86_64
libtiff-devel-4.0.9-21.el8.x86_64
libgeotiff-devel-1.5.1-1.el8.x86_64
libgeotiff-1.5.1-1.el8.x86_64
Installing openblas may work, see https://github.com/conda-forge/r-igraph-feedstock/issues/19

Why does cirlceCI does not build successfully when renv is part of a R package?

Im trying to set up a CI for a R package. In that regard I`m considering circleCI, which has worked out with previous R projects. However this time, I get the following error:
Downloading renv 0.14.0 ... OK (downloaded source)
Installing renv 0.14.0 ... Done!
Successfully installed and loaded renv 0.14.0.
Project '~/main' loaded. [renv 0.14.0]
devtools::install_deps(dependencies = TRUE)
Error in loadNamespace(x) : there is no package called ‘devtools’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
My .circleci/config.yml looks similar to that one
version: 2
jobs:
build:
docker:
- image: my_random_image
steps:
- checkout
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE)"
- run:
name: Build package
command: R CMD build .
- run:
name: Check package
command: R CMD check *tar.gz
and my_random_image looks as follows:
FROM r-base:4.1.2
RUN apt-get update \
&& apt-get install git libssl-dev ssh texlive-latex-base texlive-fonts-recommended
libcurl4-openssl-dev libxml2-dev -y \
&& rm -rf /var/lib/apt/lists/*
RUN R -e "install.packages(c('devtools', 'roxygen2'), repos='http://cran.us.r- project.org')"
So its pretty standard stuff, as far as I can see. The error only occurs if renv is part if my R package. Otherwise circleCI does not complain and runs as expected without any errors.
I would like to keep renv in my R project and therefore struggle to understand the issue and the solution to that.
appreciate any help!!
The issue here is most likely that your run stage, here:
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE)"
installs packages into the default user / site libraries, but when R is launched in your project's working directory:
Downloading renv 0.14.0 ... OK (downloaded source)
Installing renv 0.14.0 ... Done!
Successfully installed and loaded renv 0.14.0.
Project '~/main' loaded. [renv 0.14.0]
the renv autoloader is automatically downloading renv, and activating the renv project library.
By default, renv isolates projects from the user / site library, so the packages installed in your earlier steps are not visible within the project. This behavior is intentional, and ensures that different project libraries are isolated both from changes in the user / site libraries, as well as in other project libraries.
One of the following should help:
If your renv.lock is up to date, call renv::restore() before trying to use devtools or other packages;
Allow renv to see the user library, with e.g. the environment variable RENV_CONFIG_USER_LIBRARY = TRUE.
I'd recommend reading https://rstudio.github.io/renv/articles/renv.html and https://rstudio.github.io/renv/articles/ci.html if you haven't already.

Working with an R package under a conda environment in macOS

I am trying to work with an R package that includes Rcpp + OpenMP in a conda environment in macOS. I read the conda environment documentation; however, I could not fix the problem I have in the following reproducible example. Most of the documentation is based on addressing OpenMP issues (clang+llvm) on macOS. I was wondering if there are any resources or documentation for the conda environment. These steps work on a Linux system (with conda) and macOS (without conda) without any problem.
Here is the reproducible example:
In a macOS:
Step 1: Create a conda environment and install R:
conda create -n env r-essentials r-base
Step 2: activate the environment
conda activate env
Step 3: install rstudio
conda install -c r rstudio
Step 4: install some required packages
conda install -c r r-devtools
conda install -c r r-wcorr
conda install -c r r-ranger
conda install -c conda-forge r-rcpparmadillo
conda install -c r r-testthat
conda install -c conda-forge r-superlearner
conda install -c conda-forge r-polycore
conda install -c conda forge r-logger
conda install -c anaconda llvm
conda install -c conda-forge openmp
Step 5: Run rstudio
Step 6: Inside rstudio
library('devtools')
install_github('fasrc/CausalGPS')
I get the following error:
In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from env/bin/../include/c++/v1/typeinfo:60:
In file included from env/bin/../include/c++/v1/exception:81:
In file included from env/bin/../include/c++/v1/cstdlib:85:
In file included from env/bin/../include/c++/v1/stdlib.h:100:
env/bin/../include/c++/v1/math.h:773:12: error: no member named 'labs' in the global namespace; did you mean 'abs'?
return ::labs(__x);
~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
^
~/env/bin/../include/c++/v1/math.h:777:12: error: no member named 'llabs' in the global namespace
return ::llabs(__x);
~~^
~/env/bin/../include/c++/v1/math.h:785:12: error: no member named 'fabsf' in the global namespace
return ::fabsf(__lcpp_x);
~~^
~/env/bin/../include/c++/v1/math.h:789:12: error: no member named 'fabs' in the global namespace; did you mean 'abs'?
return ::fabs(__lcpp_x);
~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
^
~/env/bin/../include/c++/v1/math.h:794:12: error: no member named 'fabsl' in the global namespace
return ::fabsl(__lcpp_x);
~~^
I think I need to set some environmental variables; however, I could not find out which variables I should export. Do you have any idea?
Works for me, with some adjustments that I regard as better practice:
don't use RStudio from Conda - it is an abandoned project; see alternatives
only use conda-forge channel - mixing channels can have dynamic library issues
use a YAML for more reliable specification of requirements
explicitly declare R version (r-base)
include everything in the declared Imports (except what is included as dependencies of other packages)
conda-forge::r-cli>=3 builds are broken, so I pin that to newest working version
use mamba because conda is slow
Here is a YAML for creating the environment:
causalgps-env.yaml
name: causalgps
channels:
- conda-forge
dependencies:
- r-base=4.1
- r-tidyverse
- r-devtools
- r-xgboost
- r-superlearner
- r-earth
- r-ranger
- r-gam
- r-kernsmooth
- r-gnm
- r-polycor
- r-wcorr
- r-rlang
- r-glue
- r-logger
- r-cli>=2,<3
And the steps are:
Create env.
## install Mamba if you don't have it
## conda install -n base conda-forge::mamba
mamba env create -n causalgps -f causalgps-env.yaml
Run R session in env.
conda activate causalgps
R
Install package.
library(devtools)
install_github('fasrc/CausalGPS')
Test loading.
library(CausalGPS) ## works

How to install Julia in an anaconda environment?

One of the main features of Anaconda is that it is language agnostic as stated in their blog:
You can create environments of any binary dependency tree (different
versions of Python, R, Julia, etc.).
Recently I switched from using virtualenv to Anaconda in Python, so I was curious to try Julia in an Anaconda environment. However, I couldn't find instructions explicit enough to install Julia successfully. First, I tried naively conda create -n julia-test julia. Obviously, it didn't work. Then I found at binstar.org a Julia package (version 0.3) with the code
conda install -c https://conda.binstar.org/wakari1 julia
However, I don't want to install Julia outside of a specific virtual environment, so I changed it to:
conda create -n julia-test -c https://conda.binstar.org/wakari1 julia
It didn't throw errors but ultimately failed to start the Julia interpreter.
So, what is the correct way of installing Julia (0.2, preferably) in an anaconda environment?
UPDATE
As of March 2018, Julia v0.6.1 is available for linux-64 on the conda-forge channel:
https://anaconda.org/conda-forge/julia
It has been set up to install packages inside <env_prefix>/share/julia/site, to maintain isolation from the user's ~/.julia user's home directory.
conda create -n julia -c conda-forge julia
As of August 2017, Julia v0.5.2 is available on the conda-forge channel:
https://anaconda.org/conda-forge/julia
It has been set up to install packages inside <env_prefix>/share/julia/site, to maintain isolation from the user's ~/.julia user's home directory.
conda create -n julia -c conda-forge julia
The blog post was indicating that conda is general enough to allow packages of any type. There are no packages for Julia yet (except for the one you found in the Wakari channel, which is specific to Wakari).
Building a conda package for Julia and probably isn't difficult. Building a streamlined way to convert Julia packages into conda packages is a bit more work.
Julia 0.4.5 (not the current latest 0.5.0) is now available from the bioconda channel.
Using anaconda (python 3.6 version) and following instructions in bioconda :
# In this order
conda config --add channels conda-forge
conda config --add channels defaults
conda config --add channels r
conda config --add channels bioconda
conda install julia
So to create the corresponding virtual environment:
conda create -n julia-env julia
Nonetheless, I did not see any additional julia libraries available yet.
As of Jan 2022, Anaconda suggests using;
conda install -c conda-forge julia
See: https://anaconda.org/conda-forge/julia

Resources