ggmap Error: GeomRasterAnn was built with an incompatible version of ggproto

RGgplot2GgmapGgproto

R Problem Overview


I'm using ggmap, and got the error below:

Error: GeomRasterAnn was built with an incompatible version of ggproto.
Please reinstall the package that provides this extension.

I've installed the latest version of both ggmap(2.6.1) and ggplot2(2.2.0), but still got the same error.

R Solutions


Solution 1 - R

I ran into this problem as well today, and I had to install the GitHub development versions of ggplot2 and ggmap and restart R to get rid of this error:

devtools::install_github("dkahle/ggmap")
devtools::install_github("hadley/ggplot2")

Before that, I also reinstalled all of the packages mentioned here: https://github.com/thomasp85/ggraph/issues/10

Don't know if those reinstalls were necessary, as it was ultimately installing the GitHub version of ggmap that fixed the problem, but thought I'd mention it just in case.

Note this problem appears to stem from the recent update to ggplot2 as discussed here: https://github.com/tidyverse/ggplot2/blob/master/NEWS.md#extensions

Solution 2 - R

Reinstalling ggmap from source code can fix the problem.

install.packages("ggmap", type = "source")

Solution 3 - R

The problem persisted for some calculations after following the steps above. Therefore I installed an older version of ggplot2.

library(devtools)
install_version("ggplot2", version = "2.1.0", repos = "http://cran.us.r-project.org")

Solution 4 - R

I came across the same problem today and found that old saved ggmap images (as .RData) couldn't be read using the new ggplot2/ggmap versions (ggmap_2.6.1 & ggplot2_2.2.0) resulting in a ggproto error. Admittedly this did drive me mad for quite sometime. However, when I reran the code and produced saved maps using the new versions of the ggmap and ggplot2 the images were totally readable.

At this stage my suggestion is to rerun the code for any ggmap images you want to continue to access (preferred), or alternatively reinstall older versions of ggmap and ggplot2.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondingdingView Question on Stackoverflow
Solution 1 - RjashuView Answer on Stackoverflow
Solution 2 - RCyrilleView Answer on Stackoverflow
Solution 3 - RBenjamin ZiepertView Answer on Stackoverflow
Solution 4 - RNathanView Answer on Stackoverflow