Error Installing R Package for Linux

Error installing R package for Linux

It seems that when running R in Linux is necessary to install some build tools. As in this case, in the terminal:

sudo apt-get install libgeos-dev

Then try package install again.

hints from here

Impossible to install package after R upgrade to 4.2.1

Thanks to the comments from @MrFlick and @BenBolker, I found a solution.

I removed the .Rprofile file that was in my user home directory and that solved the problem.

Use the following command lines in your terminal :

less .Rprofile # to check what was inside the file (prompt was called)
rm .Rprofile # to remove the file

Problem with installation of R packages on ubuntu

I've found the sollution.

First, I reinstalled R (however I think it's optional).
Then other error occured, namely something like this. Commenting particular line in sources.list finally allowed to instal R. After this I got the same error as above. I was unable to install particular packages. I decided to take closer look to /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.29 not found. I found the solution here. I typed the commands provided in top voted answers anfter days of struggle it finally worked and all packages have been installed!

Unable to install some R packages in Ubuntu 20.04 because of internal compiler error: Segmentation fault

In case others also run into this issue in the future, I am posting the solution that was suggested to me by https://answers.launchpad.net/ubuntu. Here is the link to the question I posted: https://answers.launchpad.net/ubuntu/+question/696623.

The issue turned out to be that R was using gcc-9 rather than gcc-10 to compile packages. The older version of gcc was throwing an error. Here are the steps I took to solve the problem:

  1. Install gcc-10, which was not available on my system: sudo apt install gcc-10.
  2. Edit the CC= pointer in the /usr/lib/R/etc/Makeconf file to gcc-10: open Terminal, type sudo nano /usr/lib/R/etc/Makeconf and replace the current CC= to CC=gcc-10. Save the file.
  3. Restart R and run the install.packages() command for those packages that were not compiling correctly.

EDIT: Please see the comments below for a discussion. The above steps resolve the issue, but are not recommended. The issue was related to R not using the system package manager to install packages when the call install.packages() was used in R.

Installing the package bspm solved the issue for me. This package and its utility is discussed here for those who are curious.

To use install.packages() within R, bspm can be used in two ways:

  1. bspm::enable() within R and then install.packages()
  2. As written in its documentation: To enable bspm system-wide by default, include the following: suppressMessages(bspm::enable()) into the Rprofile.site file.

Thanks very much to Dirk for his guidance.



Related Topics



Leave a reply



Submit