r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
601 stars 131 forks source link

Installing on Ubuntu: dependencies ‘sf’, ‘RcppArmadillo’ are not available for package ‘lidR’ #521

Closed mavavilj closed 2 years ago

mavavilj commented 2 years ago

Installing on Ubuntu 20.04.3 LTS and RStudio 2021.09.1 Build 372 the latest from Github using:

# Ubuntu
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libgdal-dev libgeos++-dev libudunits2-dev libproj-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libxt-dev libfftw3-dev

and then

devtools::install_github("Jean-Romain/rlas")

goes OK, but

devtools::install_github("Jean-Romain/lidR")

I end up to:

Installing package into ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
ERROR: dependencies ‘sf’, ‘RcppArmadillo’ are not available for package ‘lidR’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.1/lidR’
Warning messages:
1: In i.p(...) :
  installation of package ‘classInt’ had non-zero exit status
2: In i.p(...) :
  installation of package ‘RcppArmadillo’ had non-zero exit status
3: In i.p(...) : installation of package ‘sf’ had non-zero exit status
4: In i.p(...) :
  installation of package ‘/tmp/Rtmp8WZQid/file2199f292ec5f4/lidR_3.2.4.tar.gz’ had non-zero exit status
> 

Trying to install e.g. sf manually does not work either.


Installation seemed much easier with Windows 10, is it better maintained?

Jean-Romain commented 2 years ago

The CRAN provides binary versions of the packages for Windows because it is so difficult to install packages on windows that someone has to do the job for Windows users. This is why it is easy on Windows. On linux it is much easier so nobody is doing the job for you. As a consequence it is more difficult...

That being said your problem is related to sf and RcppArmadillo. I'm not the maintainer of these packages and the message you copy pasted only tells that installation of classInt RcppArmadillo and sf failed. Try to install classInt alone and look at the error. Then RcppArmadillo. When both will be ok sf will be ok as well I guess

mavavilj commented 2 years ago

I did some manual messing around and got RccpArmadillo installed by following instructions here:

https://tommasorigon.github.io/CompStat/exe/un_A2.html

I still didn't install sf, but when I did

install.packages("lidR") in RStudio, then lidR is now (surprisingly) working properly.

But it might be good idea to add more complete instructions for installing on latest Ubuntu. `

Jean-Romain commented 2 years ago

It is not my role to explain how to install other R packages on Linux or to teach how R works on Linux. I'm only maintaining lidar related packages and there is already tons of resources on internet :wink: I'm glad you solved your problem.