Sydney-Informatics-Hub / AgReFed-Workshop

Workshop documentation, workflows and use-case examples for AgReFed DataHarvester and GEE in Python and R.
https://sydney-informatics-hub.github.io/AgReFed-Workshop/
MIT License
2 stars 3 forks source link

Error installing Sydney-Informatics-Hub/dataharvester #3

Closed natbutter closed 1 year ago

natbutter commented 1 year ago
> remotes::install_github("Sydney-Informatics-Hub/dataharvester")
Downloading GitHub repo Sydney-Informatics-Hub/dataharvester@HEAD
Installing 3 packages: png, terra, reticulate
Installing packages into ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 KB)
==================================================
downloaded 24 KB

trying URL 'https://cloud.r-project.org/src/contrib/terra_1.6-17.tar.gz'
Content type 'application/x-gzip' length 698382 bytes (682 KB)
==================================================
downloaded 682 KB

trying URL 'https://cloud.r-project.org/src/contrib/reticulate_1.26.tar.gz'
Content type 'application/x-gzip' length 1549716 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      `libpng-config --cflags` -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-zYgbYq/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c read.c -o read.o
/bin/bash: libpng-config: command not found
read.c:3:10: fatal error: png.h: No such file or directory
    3 | #include <png.h>
      |          ^~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: read.o] Error 1
ERROR: compilation failed for package ‘png’
* removing ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2/png’
* installing *source* package ‘terra’ ...
** package ‘terra’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘terra’
* removing ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2/terra’
ERROR: dependency ‘png’ is not available for package ‘reticulate’
* removing ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2/reticulate’

The downloaded source packages are in
    ‘/tmp/RtmpbTE6nO/downloaded_packages’
✔  checking for file ‘/tmp/RtmpbTE6nO/remotes5f7315af61835/Sydney-Informatics-Hub-dataharvester-0a96f29/DESCRIPTION’ ...
─  preparing ‘dataharvester’:
✔  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘dataharvester_0.0.9.tar.gz’

Installing package into ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
ERROR: dependencies ‘reticulate’, ‘terra’ are not available for package ‘dataharvester’
* removing ‘/home/nbutter/R/x86_64-pc-linux-gnu-library/4.2/dataharvester’
Warning messages:
1: In i.p(...) : installation of package ‘png’ had non-zero exit status
2: In i.p(...) : installation of package ‘terra’ had non-zero exit status
3: In i.p(...) :
  installation of package ‘reticulate’ had non-zero exit status
4: In i.p(...) :
  installation of package ‘/tmp/RtmpbTE6nO/file5f731cda3035/dataharvester_0.0.9.tar.gz’ had non-zero exit status
> 
natbutter commented 1 year ago

I needed to run:

sudo apt-get install libpng-dev libgdal-dev

Then the remotes::install_github("Sydney-Informatics-Hub/dataharvester") command worked!

Noting I already had gdal installed via QGIS and in other conda environments. But I guess I needed the system one too.

This is on Xubuntu 20.04