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

<p>Assuming that your <code>conda</code> environment name is <code>renv</code>, try running this in the terminal:</p>

<pre><code><span class="math-container">$ conda activate renv
$</span> 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 &amp;
</code></pre>

<p>This should open up the Rstudio interface, like normal, but using everything defined in your <code>renv</code> environment.</p>

<p>If you try loading the <code>DEseq2</code> library now, that might work.</p>

CC BY-SA 4.0
2018-11-30T17:54:07.847Z
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
CC BY-SA 4.0
2018-12-01T17:56:54.170Z
@NikitaVlasenko you should be able to point Rstudio to the `R` under `envs/something/bin/`.
Devon Ryan
CC BY-SA 4.0
2018-11-29T20:48:47.247Z
2018-11-29T21:43:04.903Z
2018-11-29T21:43:04.903Z
James Hawley
<p>As others have mentioned, this is likely an issue with having multiple versions of R or RStudio installed.</p>

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

<p>I've previously written a <a href="https://jlboat.github.io/how-to-set-up-a-bioinformatics-environment.html" rel="nofollow noreferrer">blog post</a> about this topic, and I can say from experience that installing R packages through conda can cause lots of headaches. </p>

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

<p>So, for example. </p>

<p>Bad: <code>conda install -c bioconda bioconductor-deseq2</code></p>

<p>Good: </p>

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

CC BY-SA 4.0
2018-11-30T16:11:05.687Z
2018-11-30T16:24:09.673Z
2018-11-30T16:24:09.673Z
LucasBoatwright
<p>Ultimately my colleague helped me to solve the issue by following the steps:</p>

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

<p>Then launching <code>rstudio</code> 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.</p>

CC BY-SA 4.0
2018-12-05T11:48:12.667Z
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
CC BY-SA 4.0
2018-12-05T18:37:52.937Z
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
CC BY-SA 4.0
2018-12-05T19:35:02.103Z
Much like the issues raised in [this blog post from Anaconda](https://www.anaconda.com/blog/developer-blog/using-pip-in-a-conda-environment/), 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
CC BY-SA 4.0
2018-12-04T17:36:50.927Z
2018-12-04T17:59:56.673Z
2018-12-04T17:59:56.673Z
Nikita Vlasenko
<p>I tried running <code>conda install -c bioconda bioconductor-deseq2</code> in a <code>conda</code> environment, but when I run <code>R</code> console and try to import <code>DESeq2</code> I am getting the error message:</p>

<blockquote>
  <p>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</p>
</blockquote>

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

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

<blockquote>
  <p>Error in library("DESeq2") : there is no package called ‘DESeq2’</p>
</blockquote>

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

<blockquote>
  <p>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’</p>
</blockquote>

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

<p>Any suggestions would be greatly appreciated.</p>

CC BY-SA 4.0
2018-11-29T04:35:38.190Z
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.
Unknown artist
CC BY-SA 4.0
2018-12-11T18:39:40.590Z
Please remember to confirm an answer once you've received one.
Stephopolis
<deseq2>
Install DESeq2 through anaconda
# Install DESeq2 through anaconda

(Asked by: username_0 on 2018-11-29)

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.

**Tags:** deseq2
> **Comments:**
> **username_1**: 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.  
> **username_2**: Please remember to confirm an answer once you've received one.  

---

## 3 answers

### Answer by username_0 on 2018-12-04. Score: 5 | Accepted answer

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.

> **Comments:**
> **username_6**: 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.  
> **username_0**: 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.  
> **username_3**: Much like the issues raised in [this blog post from Anaconda](https://www.anaconda.com/blog/developer-blog/using-pip-in-a-conda-environment/), 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  

---

### Answer by username_3 on 2018-11-29. Score: 2

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.

> **Comments:**
> **username_0**: 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.  
> **username_4**: @NikitaVlasenko you should be able to point Rstudio to the `R` under `envs/something/bin/`.  

---

### Answer by username_5 on 2018-11-30. Score: 2

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")


---

