Hong-Kong-Districts-Info/dashboard-hkdistrictcouncillors

fix: install of package 'png' failed

DataStrategyPro opened this issue · 2 comments

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. docker pull rocker/rstudio:3.6.2
  2. docker run --rm -p 8787:8787 -e ROOT=TRUE -e PASSWORD=YourPassword rocker/rstudio:3.6.2
  3. http://localhost:8787/
  4. Login
  5. In Terminal run - git clone https://github.com/avisionh/dashboard-hkdistrictcouncillors.git
  6. Open project
  7. In R console run - renv::restore()

Expected behavior
Error installing package 'png':

  • installing source package ‘png’ ...
    ** package ‘png’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include libpng-config --cflags -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -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
    #include <png.h>

Desktop (please complete the following information):
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster

Some notes on this issue
Tried this
https://community.rstudio.com/t/package-installation-failure/28938

and received this error
rstudio@7b7df37fe987:~$ sudo apt install libpng-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libpng-dev

Tried to find this package
https://packages.debian.org/search?searchon=names&keywords=libpng-dev

Going through the docker tutorial you linked before here, it seems like you are running an existing Docker container, rocker. This Docker container might not have the required stuff installed, so possibly worth trying the following also:

apt-get update

I've tried the following in my macOS command terminal:

docker run -rm -p 8787:8787 rocker/verse

Then accessing the opened instance of the image, I've entered the following in the RStudio embedded terminal:

git clone https://github.com/Hong-Kong-Districts-Info/dashboard-hkdistrictcouncillors.git
cd dashboard-hkdistrictcouncillors

From there, I switched to the R console and entered:

renv::restore()

Very similar steps to yours and got pretty similar message:
image

Generally, it might be more standard for me to create a Docker container specifically for this repo and then for people to use this container. I'll put that on our backlog.

Update

Fro discussing with @DataStrategyPro, work for me to start with base container, install packages and publish/share.