1

I am trying to install the ggmap package in R, but the dependency package jpeg has this error:

> install.packages('ggmap')
also installing the dependency ‘jpeg’


  There is a binary version available but the source version is later:
     binary  source needs_compilation
jpeg  0.1-8 0.1-8.1              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) yes
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/ggmap_3.0.0.tgz'
Content type 'application/x-gzip' length 4698880 bytes (4.5 MB)
==================================================
downloaded 4.5 MB


The downloaded binary packages are in
    /var/folders/s1/r6h4z6p93731tv7xgdlv55t40000gn/T//RtmpfHHPTi/downloaded_packages
installing the source package ‘jpeg’

trying URL 'https://cran.rstudio.com/src/contrib/jpeg_0.1-8.1.tar.gz'
Content type 'application/x-gzip' length 18116 bytes (17 KB)
==================================================
downloaded 17 KB

* installing *source* package ‘jpeg’ ...
** package ‘jpeg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c read.c -o read.o
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from read.c:1:
./rjcommon.h:7:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘jpeg’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/jpeg’
Warning in install.packages :
  installation of package ‘jpeg’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/s1/r6h4z6p93731tv7xgdlv55t40000gn/T/RtmpfHHPTi/downloaded_packages’

My R is updated, I'm using R 3.6.1 for Mac.

I have tried updating rlang, it is version 0.4.0.

Are there any solutions for this, or alternative packages that can be used to download google maps directly into R Markdown? Thanks in advance.

zx8754
  • 52,746
  • 12
  • 114
  • 209
kaleigh
  • 11
  • 2
  • Maybe related post: https://stackoverflow.com/q/51761599/680068 – zx8754 Oct 29 '19 at 08:37
  • @zx8754 thanks for the link. I’ve managed to solve the issue, turns out I just had to enter ‘no’ when R asked if I wanted to install the packages that needed compilation. `ggmap` worked fine too :) – kaleigh Jan 06 '20 at 08:22
  • 1
    Post your comment as an answer, please. – zx8754 Jan 06 '20 at 08:24

1 Answers1

1

This somehow worked for me.

> install.packages("jpeg")

  There is a binary version available but the source version is later:
     binary source needs_compilation
jpeg  0.1-9 0.1-10              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) no
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.2/jpeg_0.1-9.tgz'
Content type 'application/x-gzip' length 416927 bytes (407 KB)
==================================================
downloaded 407 KB


The downloaded binary packages are in
    /var/folders/5j/wtyhcn913d18s56lxb3gjj680000gn/T//RtmpvA9xYU/downloaded_packages
> library(ggmap)
ℹ Google's Terms of Service: <https://mapsplatform.google.com>
ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.