R package 'gfortran' is not available (for R version 3.3.1) - r

I'm trying to install the package 'gfortran' (because the package 'deSolve' demands it to be insatlled) but get the error:
install.packages("gfortran")
Warning in install.packages :
package 'gfortran' is not available (for R version 3.3.1)
How can I solve it?

You should install gfortran on your device, not in the R console.
The steps you should take are nicely written here.
In short,
Remove existing gfortran installations
Install Xcode from the App Store
Run in your terminal:
xcode-select --install
Install gfortran. You can find all releases here
Go back to R and install your desired package

Related

Installing rsvg library in R 4.0.2 (conda-forge)

I'm facing difficulties downloading the r package rsvg. I created first an environment with conda for the latest R version 4.0.2 following these instructions. I was able to download many other R packages & bioconductor packages without problem, however, this one produces huge pile of lines while configuring it and ends with errors downloadind its dependencies (systemfonts, stringi, stringr, gdtools, magick, svglite, knitr). My exact command is install.packages("rsvg", dependencies =T). Trying to download each of those packages produced also a tree of required dependencies (with configuration fail at the end of each).
Among the lines I noticed this error /user/include/freetype2/freetype/config/ftheader.h:3:12: fatal error x86_64-linux-gnu/freetype2/config/fthreader.h no such file or directory which make me suspect that my R installation is incopmlete or corrupted. I tested it with other R versions (e.g. R 3.6.0) yet the same error appear. Installing it on windows (Rstudio 3.6.2) also didn't work, and now I'm wondering if this package needs to be installed differently or it is system related problem? Any help would be highly appreciated
You need to create a new environment and then you can install R 4.+ in Anaconda. Follow these steps.
conda create --name r4-base
After activating r4-base run these commands
conda install -c conda-forge r-base
conda install -c conda-forge/label/gcc7 r-base
Finally, you will notice r-basa version 4 will be installed.
Thereafter, you can install any supported packages. But with this only, you won't have the ability to use it in the Jupyter notebook. You need to install install.packages('IRkernel') and Jupyter notebook as well if you want to use it. Otherwise you are good to go with R-Studio.
For Jupyter Installation and RKernel.
conda install jupyter
Then open the R console. Write in R console
install.packages('IRkernel')
IRkernel::installspec()
Congrats! You can use Notebook for Python and R.

cannot install phytools in ubuntu 18.04 with R 3.6

cannot install phytools
tried with devtools
library(devtools)
install_github("liamrevell/phytools")
and
install.packages("phytools")
I keep getting the same error
ERROR: dependency ‘mnormt’ is not available for package ‘phytools’
and I cannot install mnormt because
package ‘mnormt’ is not available (for R version 3.6.3)
gfortran is already installed in my system
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
any help is highly appreciated,
thanks
On Ubuntu Linux I cannot get R to update to the latest version (>4.0 at the time of writing), so, like Dirk suggests I have to install an older version of the package, one compatible with the version of R I am running.
My R version is 3.6.3, released feb 2020
I go to the mnormt page and click on "old sources" https://cran.r-project.org/src/contrib/Archive/mnormt/
I see that version 1.5-6 is the most recent release which is prior to my version of R
Following these pages: "Installing older versions of packages" https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages I copy the relevant url into this code and run it in R
packageurl <- "https://cran.r-project.org/src/contrib/Archive/mnormt/mnormt_1.5-6.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
Which fixes my problem installing mnormt and also allows packages which depend on it to be installed in the standard way (as far as I tested it)
The current version of mnormt depends on a the current version of R; you chose to remain a version behind.
So just install the previous version of mnormt, for example via
cd /tmp
wget https://cran.r-project.org/src/contrib/Archive/mnormt/mnormt_1.5-7.tar.gz
R CMD INSTALL mnormt_1.5-7.tar.gz
Prefix that last INSTALL command with sudo, or change the permission/group membership of /usr/local/lib/R/site-library, if R tells you it cannot write there.
Once mnormt is installed, proceed with the installation of phytools.
Try to add the tag version to install command, for example: devtools::install_github('cran/mnormt#R-3.0.3')
Check what version you need and replace the tag after the '#'.

R - Installing package with remotes::install_github ask for higher version of the dependencies which BiocManager::install() can not find

I need to install few packages that should be installed with remotes::install_github() like
"acidgenomics/basejump" or "satijalab/seurat".
During the installation, it need to upgrade few other packages version. The BiocManager::install program cannot find those versions and I had to install those dependencies packages version with:
R CMD INSTALL IRanges_2.20.2.tar.gz
Then other packages, that use the same packages stop working. like DESeq2,
I get the error:
Error: package or namespace load failed for ‘DESeq2’:
objects ‘rowSums’, ‘colSums’, ‘rowMeans’, ‘colMeans’ are not exported by 'namespace:S4Vectors'
I found few answers that say it happen (like url)
remotes::install_github() isn't picking up the correct Bioconductor
devel repos, whereas installing with BiocManager::install() does work
as expected.
we have the R 3.6.0 installed as a module and a lot of users uses the same R version. I need all packages to work for everyone.
How can I make all variety packages versions to work?
Finally, I install new version of R 3.6.3 with Bioconductor 3.10 and all the packages install right.

r-cran-packages on ubuntu repos

usually I install R packages from CRAN mirrors, but some of them give me problems. This almost always happens with packages strongly interacting with the system (e.g. rgl, cairoDevices etc). If I well understood when I install packages from the Ubuntu repo with
apt-get install r-cran-rgl
these will be installed in /usr/lib/R/site-library directory. For a number of packages installed in /usr/lib/R/site-library when I do update.packages(ask=FALSE) from R (working under sys admin) I get the following type of messages:
Warning: package 'ggplot2' in library '/usr/lib/R/site-library' will not be updated
I presume that this happens because the version on the cran is newer than the one on the ubuntu repos. But, the rgl package is installed
in '/usr/lib/R/site-library', however when I invoke
update.packages(ask=FALSE)
R download and tries to install a new version of rgl although the one installed is the last one available on ubuntu repos. By the way it tries to install and it fails for some error.
Therefore, what I don't understand is why it doesn't try to update ggplot2 while it tries to update rgl when both have been installed via apt-get and both have the last release number appearing on the ubuntu repos.
Thanks
Pierre

install RMySQL for Mac

I get below error when I try to install Mysql package (MAC OS)
install.packages('RMySQL')
package ‘RMySQL’ is available as a source package but not as a binary
Warning in install.packages :
package ‘RMySQL’ is not available (for R version 3.1.0)
I am not sure what I need to set in order for this to work.
The author of RMySQL no longer provide binary packages, so you will have to build from source.
I have posted the complete solution in another thread: Installing RMySQL in mavericks.
Basically, in order for install.packages('RMySQL', type='source') to work correctly, what you are lacking are:
Make sure you have "gcc" available.
Install MySQL client somewhere, e.g., via Homebrew.
Configure and build RMySQL from source in RStudio or in Terminal:
Set the 2 environment variables PKG_CPPFLAGS and PKG_LIBS to indicate where the include and lib are.
Run install.packages('RMySQL', type='source') in RStudio or R CMD INSTALL RMySQL_x.x-x.tar.gz in Terminal
Installing from source worked well for me. For those who are new to R, the way to install from source is:
install.packages('RMySQL', type='source')

Resources