But I am still getting errors related to shared object files. I'd appreciate any insight into what may be the problem. (If you think it is better to post to the R stack exchange instead I can do that)
R version 4.0.4 (2021-02-15) -- "Lost Library Book"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
My attempted command and resulting error:
> install.packages(c("tigris", "tidycensus"))
Installing packages into ‘/home/user/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tigris_1.0.tar.gz'
Content type 'application/x-gzip' length 262369 bytes (256 KB)
==================================================
downloaded 256 KB
trying URL 'https://cloud.r-project.org/src/contrib/tidycensus_0.11.4.tar.gz'
Content type 'application/x-gzip' length 1753003 bytes (1.7 MB)
==================================================
downloaded 1.7 MB
* installing *source* package ‘tigris’ ...
** package ‘tigris’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/user/R/x86_64-pc-linux-gnu-library/4.0/rgdal/libs/rgdal.so':
libgdal.so.26: cannot open shared object file: No such file or directory
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘tigris’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.0/tigris’
Warning in install.packages :
installation of package ‘tigris’ had non-zero exit status
ERROR: dependency ‘tigris’ is not available for package ‘tidycensus’
* removing ‘/home/user/R/x86_64-pc-linux-gnu-library/4.0/tidycensus’
Warning in install.packages :
installation of package ‘tidycensus’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp1UzoRP/downloaded_packages’
Warning in install.packages :
converting NULL pointer to R NULL
$ sudo apt install libgdal-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgdal-dev is already the newest version (3.2.1+dfsg-1~focal0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
The problem is on my system. On my test system with a new and clean installation of Kubuntu 20.04 LTS, I was able to install both R (4.0.4) , RStudio (version 1.4.1106) and the desired packages c("tigris", "tidycensus")) with no errors.
Thanks for marking your solution. Makes the discussion more useful for others. One annoyance with R packages is the distinction of system packages (installed with sudo) and user packages installed into the local directory. This is well and fine for server based systems, the paradigm from which UNIX and its descendants are based) and the single-user systems that the vast majority of us are using.
Then there are $PATH issues to contend with and disturbances of The Force arising from competing installations of other programs, such as Python when using {retriculate}. And the wonderful Python package manager Anaconda has been a disappointment as an R package manager, as well as multiplying problems identifying the correct Python $PATH.
And don't get me started on containers and virtual environments!
I bet it was Anaconda that fuzzied up my $PATH. I had issues with my ruby gems and jekyll as well that I tracked down to the $PATH. Do you know if conda or miniconda is a better alternative? Or is there a recommended way to install anaconda on a linux system so that it doesn't disrupt the ecosystem?
I think it depends on how much importance is attached to the details of package management. My install doesn't have a lot of Python packages to manage, so I've addressed the issue with aliases such as alias py='/usr/bin/python3.9' to do most of my work in Python and left the 3.8 OS and 3.8 Anaconda in place for when needed. Correspondingly for pip and ipython.