I am trying to install the reticulate package on my Mac and it depends on the png package, which in turn depends on libpng. I installed libpng with brew but the png package fails due to a missing libpng-config:
/bin/sh: libpng-config: command not found
However I have this in /opt/homebrew/bin/libpng-config:
which libpng-config
/opt/homebrew/bin/libpng-config
I found this that specifies the need for libpng-dev but I have no idea how to install that on my Mac. Any help is appreciated.
CodePudding user response:
Processes not started from a shell may not inherit environment variables from that shell. Start R in Terminal to make sure that your R process inherits PATH from the Terminal shell where you have run which. Something like
$ Rscript -e "install.packages(\"png\")"
should work, though you may need to select a CRAN mirror, in which case the above will throw an error. You can do that in the install.packages call, like so:
$ Rscript -e "install.packages(\"png\", repos = \"https://cloud.r-project.org\")"
or by setting a global option, like so:
$ Rscript -e "options(repos = \"https://cloud.r-project.org\"); install.packages(\"png\")"
For details, see the R for macOS FAQ and ?options.
