Dear Biostars community,
I am using Conda to install some R packages on my Mac. (e.g. "gage")
I run "conda install -n myr -c bioconda bioconductor-gage", and It gives me an error like this:
"Error: package or namespace load failed for ‘gage’: package ‘graph’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version."
This happened a few times with installations of other packages.
Every time it happens I create a new env and start over again (sorry it's stupid...I was just testing to figure out what was the problem) and I will get the same error with other packages (seems like pretty random?)
Can anybody help me out? Appreciate your help!
If you're using conda to manage R, make sure you don't use
install.packagesto manage R packages. Use
conda installinstead. In your case, try
conda update -n myr r-graphand then install
Thanks you so much! But i actually did not use install.packages() to manage that. I tried the way you suggested and i got the same error....also i am getting errors like " Error: package or namespace load failed for ‘clusterProfiler’: object ‘simplify’ is not exported by 'namespace:IRanges'". Thanks for your patience.. Sorry i am really new to conda...
You might have to reinstall a bunch of packages. Maybe try reinstalling/updating clusterProfiler and see if that helps.
In general, if an R package exists in conda you should install via conda, however, if you call R from the conda env and then use install.packages(), the library path will be in the conda environment and everything should work ok, example below. A caveat is that all the correct permissions need to be in place for R to access existing packages.
Just to make sure, you're trying to install R packages into a conda env with R installed? And the R that is installed hasn't been updated?
Also, at the moment it seems like R3.5.1 is the most "stable" https://anaconda.org/r/r/files
Your R packages will be install to ~/anaconda3/envs/r35p27/lib/R/library
Are you sure install.packages for all packages will work fine? For instance, can you show a similar log for
tidyverse is on conda, so I would use conda in this case, but out of curiousity I installed the way I describe above and it worked fine. The log is way too long to post everything because of installing dependencies and compiling, but here is the top and bottom of the log...I'll also note that I've had problems doing this with packages having openssl as a dependency.
Ah, this never worked on my MacBook Pro, probably because I had a messy base environment.
Clean conda environments are crucial. Also I had some issues with R3.6 which is why I'm still on R3.5
Thank you so much!
So, I guess I have some hints, I might possibly messed my .bash_profile file.(because i uninstalled Conda and reinstalled it a few times). Now, the situation is that, when I call R within my envs, it is atucally calling the R from the my laptop (or conda base? not sure). It should be calling the R in the specific env i guess.
I wonder what the .bash_profile look like prior to any conda installation and env creation. (Seems that every (re)installation would append some configurations to this file.).
Thank you so much! Appreciate your help!
Your default bash profile should not affect things when you
conda activate myenv. Just so you're sure, run both
which Ras well as
which -a Rand ensure you're executing the right R. Better, just use the absolute path to R and try installing to see if it works OK.
None of this should matter when you're using
conda install -c conda-forge r-package_namethough.
Yes, Thank you! Yea I see, the version is not the problem. I have my local R and the R in my env, and I can see different version number when I call them correspondingly. So, all good!
The situation now is that when I install the package (e.g. 'gage') I need there are dependencies (e.g. ‘graph') that are installed by an R version with different internals (as the error indicated). Then I tried to fix this, first, using conda update -n myr bioconductor-gosemsim in this env, and then re-install 'gage'. Unfortunately, this did not work. Then, I tried to install this package within R in my specific environment using install.packages(). and this failed too. This ended up with a warning message "Warning message: package ‘GOSemSim’ is not available (for R version 3.6.0)". Anyways, made no difference to the original issue.....
I have no idea why the dependencies (for example here 'graph') are installed by another R because it should come with the master package (for example here "gage") and be installed at the same time and using same R (the R in my env).
Thank you so much!!!
Do you happen to have a
R_LIBSsettings in an environment file (
~/.Renvironperhaps)? That could interfere with the order of library locations in
.libPaths(). But then, if you're facing this error with
conda install, it has nothing to do with R settings.
Can you give me the list of packages to install so I can try and replicate this error on my side?
I will try to find that. And also I think conda install works well.
For now I am struggling with some errors:
For package "clusterProfiler":
For package "gage":
Appreciate your help so much!!
If you're using
install.packages, please add
type='source'for each package as you go down the dependency rabbit hole.
Installation somehow broke as shown. type = 'source' added but it won't proceed.
May I ask what is gonna print out if you do "echo $R_HOME". Do we have to specify R_HOME in .bash_profile on our Macs? My friend who is using Conda has the R path (same as which R in that env) printed out if he do "echo $R_HOME". Is this potentially a problem? Thank you!
I've never had to use
R_HOME. What does that variable do and why are you using it?
I never used it neither (And I don't think it is necessary on Mac, perhaps?).
We were doing troubleshooting and we just noticed this is a difference and potentially could be an issue......
It seems to be set by R as it starts up. I guess it gets unset when R is exited.
However, it does get set on my HPC when I use
module load R(
setenv R_HOMEis part of the module file, and I'm guessing it was placed there for some purpose). If you're just using your local computer, unset the
R_HOMEvariable and see if that changes anything.