asikhalaban
asikhalaban

Reputation: 125

Unable to Install Plotly in R

I am trying to install plotly library in R. I tried following commands:

install.packages("plotly")
library(plotly)

But I got an error.

There is a binary version available but the source version is later:
binary source needs_compilation
plotly  4.5.6  4.6.0             FALSE

installing the source package ‘plotly’

trying URL 'https://cran.rstudio.com/src/contrib/plotly_4.6.0.tar.gz'
Content type 'application/x-gzip' length 980458 bytes (957 KB)
==================================================
downloaded 957 KB

* installing *source* package ‘plotly’ ...
** package ‘plotly’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
Warning: package ‘ggplot2’ was built under R version 3.3.2
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck =    vI[[i]]) : 
there is no package called ‘assertthat’
ERROR: lazy loading failed for package ‘plotly’
* removing    ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/plotly’
Warning in install.packages :
installation of package ‘plotly’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/7c/6q_1znps54zc62j_9pr_tx9c0000gn/T/RtmpyyWVTb/downloaded_packages’

Can someone help with the error to install R?

Upvotes: 3

Views: 17282

Answers (1)

kanataki
kanataki

Reputation: 433

You need to install all those packages that have been named in the error messages. There are a couple of other dependencies to be installed. Debian:

sudo apt-get install libssl-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssh2-1-dev
sudo apt-get install libpq-dev
sudo apt-get install zlib1g-dev

Centos:

sudo yum -y install openssl-devel
sudo yum -y install libcurl libcurl-devel

You won't need all of them but better safe. I also like to install devtools: install.packages("devtools")

Upvotes: 2

Related Questions