Trying to get Tidyverse installed in Linux mint 20.2 - r

I've been working on getting RStudio to open on and off for the last few days, finally got it running and started installing packages. Readr installed fine but tidyverse refuses to install.
/usr/bin/ld: /usr/local/lib/libcrypto.a(v3_genn.o): relocation R_X86_64_PC32 against symbol `GENERAL_NAME_it' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:6: openssl.so] Error 1
ERROR: compilation failed for package ‘openssl’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/openssl’
Warning in install.packages :
installation of package ‘openssl’ had non-zero exit status
ERROR: dependency ‘openssl’ is not available for package ‘ids’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/ids’
Warning in install.packages :
installation of package ‘ids’ had non-zero exit status
ERROR: dependency ‘openssl’ is not available for package ‘httr’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/httr’
Warning in install.packages :
installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘gargle’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/gargle’
Warning in install.packages :
installation of package ‘gargle’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘rvest’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/rvest’
Warning in install.packages :
installation of package ‘rvest’ had non-zero exit status
ERROR: dependencies ‘gargle’, ‘httr’ are not available for package ‘googledrive’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/googledrive’
Warning in install.packages :
installation of package ‘googledrive’ had non-zero exit status
ERROR: dependencies ‘gargle’, ‘googledrive’, ‘httr’, ‘ids’ are not available for package ‘googlesheets4’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/googlesheets4’
Warning in install.packages :
installation of package ‘googlesheets4’ had non-zero exit status
ERROR: dependencies ‘googledrive’, ‘googlesheets4’, ‘httr’, ‘rvest’ are not available for package ‘tidyverse’
* removing ‘/home/william/R/x86_64-pc-linux-gnu-library/3.6/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpyoCTNu/downloaded_packages’
To fix this I've tried suggestions from two places:
The first option was 'sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev'
from this website: https://blog.zenggyu.com/en/post/2018-01-29/installing-r-r-packages-e-g-tidyverse-and-rstudio-on-ubuntu-linux/
The second this was 'sudo apt-get install r-base-dev xml2 libxml2-dev libssl-dev libcurl4-openssl-dev unixodbc-dev'
from the rstudio community page: https://community.rstudio.com/t/cant-install-tidyverse/29293
A third option I found that is too advanced for me without guidance is this:
If openssl is already installed, check that 'pkg-config' is in your PATH and
PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
I'm sure I'm doing something wrong. I think something may not be in the proper place or is linked to the wrong location. Any assistance would be greatly appreciated.
(Also,for reference, this is the first time I've used linux so please dumb answers down as much as possible)

I've now gotten this to work. By looking at the error messages I found the dependencies that need to be installed before tidyverse can be installed (and function).
It is preferable but not necessary to get the latest version of R installed. I followed the steps in this tutorial:
https://linuxconfig.org/how-to-install-rstudio-on-ubuntu-20-04-focal-fossa-linux
In the interest of putting everything in one place, I'll put the steps here:
Step 1:
$ sudo apt update
$ sudo apt -y install r-base gdebi-core
Step 2: Install Rstudio from their website
Step 3: For this step, make sure you're in the folder that has the file downloaded, for me that was in downloads
$ sudo gdebi rstudio-1.2.5019-amd64.deb
Step 4: Open Rstudio
To get tidyverse to work, my error messages were all about non-zero exit statuses. What I did was to go through, find the packages that weren't properly installing, and manually install them.
My first problem was with curl. I tried installing it in Rstudio first. When I got an error, I went into terminal and installed it with
sudo apt-get install libcurl4-openssl-dev
If openssl refuses to install try:
sudo apt-get install libssl-dev
I tried installing tidyverse again, no dice. It was still having trouble with xml2 and rvest. I installed xml2 in terminal with.
sudo apt-get install libxml2-dev
After that, rvest installed using Rstudio and tidyverse installed successfully.
These instructions work with both R 4.1.1 and R 3.4.4

It would seem that the R version here is quite old, version 3.6. A bunch of things that are tidyverse related broke around the switch from 3.* to 4.*.
If you follow a procedure like this, it should get you started on the right path with the proper R version and the rest will likely fall into place.
https://linuxize.com/post/how-to-install-r-on-ubuntu-20-04/
Occasionally, on linux machines, you will have packages that fail to install because of system level dependencies that are missing. Those messages are usually informative; they will tell you what you need and the command for acquiring it.

Related

install daewr package in R 4.0

hi i am trying to install package for experiment designs like this
install.packages("daewr", dependencies = T)
but it returns the following
configure: error: GNU MP not found, or not 4.1.4 or up, see http://gmplib.org
ERROR: configuration failed for package ‘gmp’
* removing ‘/home/yeferson/R/x86_64-pc-linux-gnu-library/4.0/gmp’
Warning in install.packages :
installation of package ‘gmp’ had non-zero exit status
ERROR: dependency ‘gmp’ is not available for package ‘partitions’
* removing ‘/home/yeferson/R/x86_64-pc-linux-gnu-library/4.0/partitions’
Warning in install.packages :
installation of package ‘partitions’ had non-zero exit status
ERROR: dependency ‘partitions’ is not available for package ‘DoE.base’
* removing ‘/home/yeferson/R/x86_64-pc-linux-gnu-library/4.0/DoE.base’
Warning in install.packages :
installation of package ‘DoE.base’ had non-zero exit status
ERROR: dependency ‘DoE.base’ is not available for package ‘FrF2’
* removing ‘/home/yeferson/R/x86_64-pc-linux-gnu-library/4.0/FrF2’
Warning in install.packages :
installation of package ‘FrF2’ had non-zero exit status
ERROR: dependency ‘FrF2’ is not available for package ‘daewr’
* removing ‘/home/yeferson/R/x86_64-pc-linux-gnu-library/4.0/daewr’
Warning in install.packages :
installation of package ‘daewr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpB1bSe0/downloaded_packages’
so i decided to download the file from https://cran.r-project.org/web/packages/daewr/index.html
after trying to install it returns me
also installing the dependencies ‘gmp’, ‘partitions’, ‘DoE.base’, ‘FrF2.catlg128’
I try to install the first one but it asks for a Bessel package and it still gives me problems
I solved it by installing dependency one by one, many answer you install the dependencies but they do not say how I will explain them for the new ones in linux and in R to install the daerw package with the aforementioned problems, install the following in the linux console
sudo apt-get install libgsl-dev
with that install libraries now I can open R and install
install.packages('gsl')
then I opened the linux console again and installed
sudo apt-get install libgmp-dev
I go back to R and install
install.packages("gmp", dependencies = T)
now I can install the package without problems
install.packages("daewr", dependencies = T)
library(daewr)
I hope that any comment is welcome.

ERROR: compilation failed for package ‘xml2’

I am installing "rvest" and "xml2" packages in Ubuntu 16.04. But on multiple times i am getting the error as below
/usr/lib/R/etc/Makeconf:143: recipe for target 'connection.o' failed
make: *** [connection.o] Error 1
ERROR: compilation failed for package ‘xml2’
* removing ‘/home/prdmcl/R/x86_64-pc-linux-gnu-library/3.2/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
I checked multiple sources and did this also
sudo apt-get install libcurl4-openssl-dev libssl-dev
sudo apt-get install libxml2-dev
But failed to install.
Seems to be a specific problem with your system(mainly with C++), not with the package.
I had the same problem, and I used this workaround on R command line :
withr::with_makevars(c(CXX = "g++ -std=c++11"),install.packages("xml2", verbose = TRUE))
This will install xml2. After that, you can install rvest package

How to fix 'libproj not found in standard or given locations' error in r

I'm trying to install the 'agricolae' package on R, but I get an error saying
configure: error: libproj not found in standard or given locations.
ERROR: configuration failed for package ‘sf’
* removing ‘/R/x86_64-pc-linux-gnu-library/3.6/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
ERROR: dependency ‘sf’ is not available for package ‘spdep’
* removing ‘/R/x86_64-pc-linux-gnu-library/3.6/spdep’
Warning in install.packages :
installation of package ‘spdep’ had non-zero exit status
ERROR: dependency ‘spdep’ is not available for package ‘agricolae’
* removing ‘/R/x86_64-pc-linux-gnu-library/3.6/agricolae’
Warning in install.packages :
installation of package ‘agricolae’ had non-zero exit status
I recently upgraded to Ubuntu 18.04.2 and R version 3.6.0 (2019-04-26) -- "Planting of a Tree" and that's when the problems started.
When I do
$ sudo apt-get install -y libproj-dev
I get:
libproj-dev is already the newest version (5.2.0-1~bionic0).
The error says that package 'sf' is not available for dependency 'spdep'. So you should be attempting to install pkg 'sf'. (I'm on the same OS as you and pkg:agricolae installed without problem just now. I have a more complete set of spatial R and system packages than you do.)
Edit: There have been reports that it was necessary in addressing this problem to create an environment link to the location of your libraries:
$ export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
(From: https://stat.ethz.ch/pipermail/r-sig-geo/2018-August/026740.html which in turn linked to https://gis.stackexchange.com/questions/157059/repairing-broken-gdal-and-proj-4-on-ubuntu, which has so further debugging options mentioned.)

Install R package in Jupyter

I have been trying over the weekend to install mosaic, car and some other packages on an R kernel (3.4.2) in Jupyter Notebook running Ubuntu 16.04. I have tried install.packages('car', '/home/jayaramdas/anaconda3/lib/R/library/', repos='http://cran.us.r-project.org'): it returns:
also installing the dependency ‘pbkrtest’
Warning message in install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
“installation of package ‘pbkrtest’ had non-zero exit status”Warning message in install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
“installation of package ‘car’ had non-zero exit status”
I've tried installing it in the original R package and I get this:
Warning messages:
1: In install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
installation of package ‘pbkrtest’ had non-zero exit status
2: In install.packages("car", "/home/jayaramdas/anaconda3/lib/R/library/", :
installation of package ‘car’ had non-zero exit status
I tried using Rstudio to install it, but it won't let me write the file. I also tried downloading the zip file for Ubuntu and it still gave the 'non-zero exiterror. Is this a usual problem that people have withcar` and other R packages? I am just trying to figure how to add some packages to my jupyter notebook.
You are on Ubuntu. You want to use a package manager (conda).
May I suggest you use the native one?
sudo apt-get install r-cran-car
will install car and all its dependencies. If not, file an Ubuntu bug report.
Similarly, you can get many more packages from Ubuntu: apt-cache search 'r-cran-*'. And once you consider the Rutter PPAs you have a large part of CRAN prebuilt.

installation of package ‘devtools’ had non-zero exit status on Ubuntu

I'm trying to install devtools in a PowerPC with a R version 3.1.1 but failed at the end because the curl library:
...
** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/path
to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so': /path
to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so:
undefined symbol: BSWAP_32 Error: loading failed Execution halted
ERROR: loading failed
* removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/curl’ ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/httr’ ERROR: dependency ‘curl’ is not available for package ‘rversions’
* removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/rversions’ ERROR:
dependencies ‘httr’, ‘rversions’ are not available for package
‘devtools’
* removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/devtools’
The downloaded source packages are in
‘/tmp/RtmpD0yE63/downloaded_packages’ Warning messages: 1: In
install.packages("devtools") : installation of package ‘curl’ had
non-zero exit status 2: In install.packages("devtools") :
installation of package ‘httr’ had non-zero exit status 3: In
install.packages("devtools") : installation of package ‘rversions’
had non-zero exit status 4: In install.packages("devtools") :
installation of package ‘devtools’ had non-zero exit status
I've already installed libcurl4-gnutls-dev and libcurl4-openssl-dev and the libcurl version is 7.38.0.
Does anyone know a fix to this? Thanks ;)
The same problem happened to me when I was trying to install "devtools" package on a new machine with Ubuntu 16.04 system.
I tried many answers including the adopted one above, but I still couldn't solve the problem until I noticed another warning information "(as ‘lib’ is unspecified)". Then I realized that I was running R as a normal user while the R base is installed by root. It means the package "devtools" couldn't be installed into the default R library folder and possibly couldn't use some dependent packages. Then the solution became very easy: run R as root user and then install "devtools".
Following the instructions of Dean Attali (https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04), I summarize the steps below. Just run them in a terminal.
$ sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev
$ sudo su
$ R
> install.packages('devtools', repos='http://cran.rstudio.com/')
That's it. Since the package is installed by root, it can be used by all users of the system.
For Curl use:
apt-get -y build-dep libcurl4-gnutls-dev
apt-get -y install libcurl4-gnutls-dev
And you should update the R version to R-3.1.2
wget http://cran.r-project.org/src/base/R-3/R-3.1.2.tar.gz
I m using Ubuntu 16.04 and this is how I solved this issue:
aptitude install libssl-dev
then aptitude packg manage will allow you to choose the right version which is required for installation of devtools.
Repeat the same for
aptitude libcurl4-gnutls-dev
aptitude libxml2-dev
Finally, install this libgit2 lib
devtools::install_github('ropensci/git2r')
devtools::load_all()
R CMD INSTALL git2r
I could not solve it with apt-get packg manager. Thats all :) !
This error was happening when I was using 3.0.2. I updated the R, now It is fine. I also spent the one day to find the solution. I tried the all the solution. But, no effect. I updated the R using this solution. Now, devtools package is working.
Fedora 34
What did it for me was:
sudo dnf groupinstall "Development tools"
Not sure about that, but also:
sudo dnf install freetype-devel libpng-devel libtiff-devel libjpeg-turbo-devel
Don't know, don't care, but it worked!

Resources