I tried running conda install -c bioconda bioconductor-deseq2 in a conda environment, but when I run R console and try to import DESeq2 I am getting the error message:

Error: package or namespace load failed for ‘GenomeInfoDb’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called ‘GenomeInfoDbData’ Error: package ‘GenomeInfoDb’ could not be loaded

When I try installing GenomeInfoDbData and GenomeInfoDb using conda, it says that the packages were already installed. If I run install.packages(GenomeInfoDb) from R console, it is telling me that the package is not available for R version 3.5.1.

I want to import DESeq2 in Rstudio though and it is giving me a different error when I try importing DESeq2:

Error in library("DESeq2") : there is no package called ‘DESeq2’

I do not get why Rstudio does not see that I alrerady installed DESeq2 with conda. If I try running biocLite("DESeq2") from Rstudio I get the following error:

Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/cluster/libs/cluster.so': dlopen(/Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/cluster/libs/cluster.so, 6): Symbol not found: _libintl_dgettext Referenced from: /Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/cluster/libs/cluster.so Expected in: /Users/nikitavlasenko/miniconda3/envs/renv/lib/R/lib/libR.dylib in /Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/cluster/libs/cluster.so ERROR: lazy loading failed for package ‘Hmisc’ * removing ‘/Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/Hmisc’ ERROR: dependency ‘Hmisc’ is not available for package ‘DESeq2’ * removing ‘/Users/nikitavlasenko/miniconda3/envs/renv/lib/R/library/DESeq2’

So, supposedly the issue is with Hmisc. I installed the package successfully with conda, but Rstudio is apparently does not know about it. Running install.packages("Hmisc") gives the first part of the error with missing cluster.so library.

Any suggestions would be greatly appreciated.

  • 2
    Are you sure the R you're running from the command line is installed through Anaconda as well? What is the output of which R? As for RStudio, that's weird... Seems like it's aware of your Conda installation, although could be some conda env tomfoolery. – Kirill G Nov 29 at 4:35

Sounds like you might have an issue with which R Rstudio is running. If you didn't install Rstudio through conda, Rstudio may be using its own version of R that is bundled with Rstudio, instead of the one you've installed via conda.

Assuming that your conda environment name is renv, try running this in the terminal:

$ conda activate renv
$ conda install r::rstudio -y

$ which rstudio
/Users/nikitavlasenko/miniconda3/envs/renv/bin/rstudio
# or something like this ^

# run Rstudio as a background shell process
rstudio &

This should open up the Rstudio interface, like normal, but using everything defined in your renv environment.

If you try loading the DEseq2 library now, that might work.

  • My R is pointing to conda, but not to virtual environment of the conda. Rstudio is pointing to virtual environment. So, now I do not know how I can switch R to the one used by the virtual environment. – Nikita Vlasenko Nov 30 at 17:54
  • 2
    @NikitaVlasenko you should be able to point Rstudio to the R under envs/something/bin/. – Devon Ryan Dec 1 at 17:56

As others have mentioned, this is likely an issue with having multiple versions of R or RStudio installed.

I highly recommend that any R/RStudio version not installed inside conda be removed. This includes any installed libraries.

I've previously written a blog post about this topic, and I can say from experience that installing R packages through conda can cause lots of headaches.

You'll have an easier time if you install R/RStudio via conda and then install R packages the traditional way, inside R/RStudio.

So, for example.

Bad: conda install -c bioconda bioconductor-deseq2

Good:

conda install rstudio
# Then, inside RStudio
source("https://bioconductor.org/biocLite.R")
biocLite("DESeq2")

Ultimately my colleague helped me to solve the issue by following the steps:

  1. Created environment: conda create --name myenv
  2. Activated it: source activate myenv
  3. Edited .condarc to set the priority of the channels to be the following (top to bottom): conda-forge, bioconda, r, default
  4. Checked that the channels are set in the correct order: conda config --get channels
  5. conda install r=3.5.1
  6. conda install r-essentials
  7. conda install rstudio
  8. Installation of all of the bioconductor packages through bioconda and never install anything from inside R or Rstudio (I guess that is how it was broken)

Then launching rstudio from within the environment. Maybe it is not a kind of quick fix and it could have been solved easier, but I was not able to.

  • 1
    The issue here was likely that you used two different package managers (conda and R), each setting and managing their own paths. I would argue that the conclusion to never install anything from inside R or Rstudio is misleading, as the latter has a perfectly fine package manager - as long as you don't mix your installations. – Michael Schubert Dec 5 at 11:48
  • Yeah, just need to select one way of doing it and never use the other. Idk, but the issue came up from using installations from within R/Rstudio, and maybe it will never happen if we use just conda, hard to say. – Nikita Vlasenko Dec 5 at 18:37
  • Much like the issues raised in this blog post from Anaconda, mixing package managers can cause some headaches. If you can, try and stick to one method, but, unfortunately, it seems like that's often not possible – James Hawley Dec 5 at 19:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.