2
$\begingroup$

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.

$\endgroup$
2
  • 2
    $\begingroup$ 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. $\endgroup$ Nov 29, 2018 at 4:35
  • $\begingroup$ Please remember to confirm an answer once you've received one. $\endgroup$ Dec 11, 2018 at 18:39

3 Answers 3

5
$\begingroup$

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.

$\endgroup$
3
  • 1
    $\begingroup$ 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. $\endgroup$ Dec 5, 2018 at 11:48
  • $\begingroup$ 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. $\endgroup$ Dec 5, 2018 at 18:37
  • $\begingroup$ 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 $\endgroup$ Dec 5, 2018 at 19:35
2
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Nov 30, 2018 at 17:54
  • 2
    $\begingroup$ @NikitaVlasenko you should be able to point Rstudio to the R under envs/something/bin/. $\endgroup$
    – Devon Ryan
    Dec 1, 2018 at 17:56
2
$\begingroup$

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")
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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