This will be a very short post that I am making since I wasn’t able to find the answer while googling. I am finally getting around to playing with the dada2 pipeline for gene marker analysis. The motivation for using a conda environment to keep everything organized is to prevent myself from breaking my current R install for a complicated (for me) project that is not yet published. It seems some of my library versions won’t play well with eachother and I figure this is a better practice anyways.
So whats the deal?
Well it appears a monkey hacked my system (me) at one point trying to get R to recognize my local directory where I keep R packages. I have two variables permanently sourced in my .bashrc file (R_LIBS & R_LIBS_USER), which I think are redundant for their purpose. I also have a .Renviron file and a .Rprofile file in my home directory that explicitly define R_LIBS and .libPaths(), respectively. Looks like I just threw the book at the problem at one point…
So the problem is R activated from the new conda environment sees my local directory. Unsetting R_LIBS and R_LIBS user is not sufficient as the .Renviron and .Rprofile files have the highest weight in the home directory.
To get around the problem, I added an extremely simple shell script in my conda etc path ($HOME/.conda/envs/myenv/conda/etc/activate.d and ../deactivate.d). The activate.d/Renviron_fix.sh script looks like this:
The deactivate.d/Renviron_fix.sh script is:
And now my conda R install doesn’t talk to my base install!! Ugly, but functional.