New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

**Installation** on Linux (Ubuntu) #150

Open
mtennekes opened this Issue Nov 7, 2017 · 10 comments

Comments

Projects
None yet
7 participants
@mtennekes
Owner

mtennekes commented Nov 7, 2017

I've created an installation file for Ubuntu: see https://github.com/mtennekes/tmap/tree/master/ubuntu_installation.sh

Could you check if this scripts works? If not, we can use this thread to improve it.

@larnsce

This comment has been minimized.

larnsce commented Nov 15, 2017

I have followed through the installtion file, but did not manage to successfully install the tmap package. It seems as if the issue is with the rgdal package.

Beginning of Traceback error message:

installing to /home/larnsce/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded

 *** caught segfault ***
address 0x1e, cause 'memory not mapped'

End of Traceback error message:

22: tools:::.test_load_package("rgdal", "/home/larnsce/R/x86_64-pc-linux-gnu-library/3.4")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault
ERROR: loading failed
* removing ‘/home/larnsce/R/x86_64-pc-linux-gnu-library/3.4/rgdal’

My sessionInfo():

R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.04

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.7.0
LAPACK: /usr/lib/lapack/liblapack.so.3.7.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_CH.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=de_CH.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_CH.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] bindrcpp_0.2       ggalt_0.4.0        mapdata_2.2-6      maps_3.2.0         sp_1.2-5           ggmap_2.6.1        dplyr_0.7.4       
 [8] purrr_0.2.3        readr_1.1.1        tidyr_0.7.1        tibble_1.3.4       ggplot2_2.2.1.9000 tidyverse_1.1.1   

loaded via a namespace (and not attached):
 [1] reshape2_1.4.2     haven_1.1.0        lattice_0.20-35    colorspace_1.3-2   yaml_2.1.14        rlang_0.1.2        foreign_0.8-69    
 [8] glue_1.1.1         RColorBrewer_1.1-2 modelr_0.1.1       readxl_1.0.0       jpeg_0.1-8         bindr_0.1          plyr_1.8.4        
[15] stringr_1.2.0      munsell_0.4.3      gtable_0.2.0       cellranger_1.1.0   rvest_0.3.2        RgoogleMaps_1.4.1  mapproj_1.2-5     
[22] psych_1.7.5        labeling_0.3       knitr_1.17         forcats_0.2.0      extrafont_0.17     parallel_3.4.2     Rttf2pt1_1.3.4    
[29] broom_0.4.2        proto_1.0.0        Rcpp_0.12.13       KernSmooth_2.23-15 geosphere_1.5-5    scales_0.5.0.9000  jsonlite_1.5      
[36] proj4_1.0-8        mnormt_1.5-5       digest_0.6.12      rjson_0.2.15       hms_0.3            png_0.1-7          stringi_1.1.5     
[43] ash_1.0-15         grid_3.4.2         tools_3.4.2        magrittr_1.5       lazyeval_0.2.0     extrafontdb_1.0    pkgconfig_2.0.1   
[50] MASS_7.3-47        xml2_1.1.1         lubridate_1.6.0    assertthat_0.2.0   httr_1.2.1         R6_2.2.2           nlme_3.1-131      
[57] compiler_3.4.2   

Installing rgdal from source gives the following different segfault message:

 *** caught segfault ***
address 0x7fe075206833, cause 'invalid permissions'

This might be relevant:

./configure: line 2112: 21315 Aborted                 ./proj_conf_test2
checking PROJ.4: epsg found and readable... yes
./configure: line 2187: 21324 Aborted                 ./proj_conf_test3
checking PROJ.4: conus found and readable... yes
@mtennekes

This comment has been minimized.

Owner

mtennekes commented Nov 19, 2017

So, the problem is the gdal library.

This post is also about rgdal and Ubuntu 17.04: https://stackoverflow.com/questions/44543935/trouble-installing-rgdal-package-on-r-3-4-in-ubuntu-17-04

@djvanderlaan Do you know if my tmap Ubuntu script (see initial post) also works on 17.04? More specifically, did you also install the dev version of gdal from the ubuntugis-unstable repository?

@djvanderlaan

This comment has been minimized.

djvanderlaan commented Nov 20, 2017

I am currently working on 17.10.

On 17.04, I used the default version of libgdal-dev to install the rgdal package. The one that ships with Ubuntu 17.04. I had no problems with that. I hadn't installed tmap, so I don't know if that worked.

I just installed tmap on ubuntu 17.10 and had to install the following packages, besides the libgdal-dev (and possible other packages) that was already installed:

sudo apt install libudunits2-dev 
sudo apt install libv8-dev 
sudo apt install libjq-dev 
sudo apt install libprotobuf-dev 
sudo apt install protobuf-compiler

So, that maps nicely with your script. I don't think it is necessary to use the ppa's, and think the default versions should work (if so, I prefer the ones that ship with ubuntu). As for the v8-dev, I would leave out the version number, as that will change.

I have no clue what causes the error message above. The session info includes a lot of attached packages. Perhaps, try with a clean R session?

@mtennekes

This comment has been minimized.

Owner

mtennekes commented Nov 20, 2017

Thx! I've borrowed all the ppa's and specific version definitions from other installation procedures. It works for me with Ubuntu 16.04 Does it make sense to specify the current script for Ubuntu 16.X and yours for Ubuntu 17.X?

@djvanderlaan

This comment has been minimized.

djvanderlaan commented Nov 20, 2017

I tried your code in a ubuntu 16.04 docker container. I got it working with the following Docker script:

FROM ubuntu:16.04

RUN echo "deb http://cloud.r-project.org/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list.d/r.list \
  && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 \
  && apt-get update && apt-get install -y \
      software-properties-common \
  && rm -rf /var/lib/apt/lists/* \
  && add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable \ 
  && add-apt-repository -y ppa:opencpu/jq

RUN apt-get update && apt-get install -y \
      r-base-dev \
      libudunits2-dev libgdal-dev libgeos-dev libproj-dev \
      libv8-dev \
      libjq-dev \
      libprotobuf-dev protobuf-compiler \
  && rm -rf /var/lib/apt/lists/*


RUN echo "local({ r <- getOption('repos'); r['CRAN'] <- 'https://cloud.r-project.org'; options(repos = r)})" >> \
    /usr/lib/R/etc/Rprofile.site \
  && echo ".libPaths('/usr/local/lib/R/site-library')" >> /usr/lib/R/etc/Rprofile.site \
  && Rscript -e "install.packages('tmap')"

I don't have time to clean it up to a shell script, but I believe the main changes with your script are:

  • Make sure you add the CRAN ubuntu repo to install the latest version of R. The one that comes with ubuntu 16.04 doesn't support rgdal (I believe that is R 3.2).
  • add-apt-repository doesn't exist by default in 16.04. I had to install software-properties-common.
@ccamara

This comment has been minimized.

ccamara commented Dec 11, 2017

Using ubuntu 16.04 , can't install tmap using your script:

> library(tmap)
Error: package or namespace load failed for ‘tmap’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/ccamara/R/x86_64-pc-linux-gnu-library/3.4/sf/libs/sf.so':
  liblwgeom-2.3.so.0: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio

which translates into something like liblwgeom-2.3.so.0: can't find shared object file: Folder or file do not exist

don't know if it helps, but some days ago, rgdal was updated to 2.2.1 and broke my previously working tmap installation (as well as my qgis installation too, but I'm afraid that's another topic).

@bczernecki

This comment has been minimized.

bczernecki commented Dec 12, 2017

@ccamara : I had this same issue so I decided to manually install liblwgeom-2.3 (together with liblwgeom-dev). This line should solve this issue:

sudo apt-get install liblwgeom-2.3-0

@ccamara

This comment has been minimized.

ccamara commented Dec 13, 2017

I can confirm that adding this line tmap is installed perfectly on ubuntu 16.04 LTR

@ElPaDe

This comment has been minimized.

ElPaDe commented Feb 26, 2018

I had tmaps running on Ubuntu 17.04, but could not make it runon Ubuntu 17.10. All Ubuntu-packages you recommend were installed, but I kept getting the following error for install.packages('tmaps'):

* installing *source* package ‘tmap’ ...
** package ‘tmap’ successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/local/lib/R/site-library/sf/libs/sf.so':
  /usr/local/lib/R/site-library/sf/libs/sf.so: undefined symbol: _ZN17GDALDriverManager14GetDriverCountEv
ERROR: lazy loading failed for package ‘tmap’
* removing ‘/usr/local/lib/R/site-library/tmap’
* restoring previous ‘/usr/local/lib/R/site-library/tmap’

My solution might be obvious, but kept me searching for long time:
install.packages('sf') install.packages('tmap')
Now is runs.

HTH

@larnsce

This comment has been minimized.

larnsce commented Apr 5, 2018

I have moved on to Ubuntu 17.10. but still can't get tmap installed. I have once more installed all packages as listed here before trying to install tmap. The problem still seems to be with the rgdal package,

Traceback error message:

installing to /home/larnsce/R/x86_64-pc-linux-gnu-library/3.4/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded

 *** caught segfault ***
address 0x21000018, cause 'memory not mapped'

Traceback:
 1: .Call("PROJ4_proj_def_dat_Installed", PACKAGE = "rgdal")
 2: assign("has_proj_def.dat", .Call("PROJ4_proj_def_dat_Installed",     PACKAGE = "rgdal"), envir = .RGDAL_CACHE)
 3: fun(libname, pkgname)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch(fun(libname, pkgname), error = identity)
 8: runHook(".onLoad", env, package.lib, package)
 9: loadNamespace(package, lib.loc)
10: doTryCatch(return(expr), name, parentenv, handler)
11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
12: tryCatchList(expr, classes, parentenv, handlers)
13: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
14: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
15: withCallingHandlers(expr, packageStartupMessage = function(c) invokeRestart("muffleMessage"))
16: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
17: doTryCatch(return(expr), name, parentenv, handler)
18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
19: tryCatchList(expr, classes, parentenv, handlers)
20: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        msg <- conditionMessage(e)        sm <- strsplit(msg, "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && identical(getOption("show.error.messages"),         TRUE)) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
21: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
22: tools:::.test_load_package("rgdal", "/home/larnsce/R/x86_64-pc-linux-gnu-library/3.4")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault

Session info

sessionInfo()

R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_CH.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_CH.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_CH.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3    yaml_2.1.18 

@Nowosad Nowosad closed this May 1, 2018

@mtennekes mtennekes reopened this Aug 8, 2018

@mtennekes mtennekes added the sticky label Aug 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment