How to Install R's devtools and digitize?
httr
imports the openssl
package which needs as system requirement libssl-dev
(sudo apt install libssl-dev
)
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
...
The curl
package needs as system requirement libcurl4-openssl-dev
:
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
...
So, to install you will need to run:
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-openssl-dev
Then start an R shell with sudo R
and:
install.packages('httr')
install.packages('git2r')
install.packages('devtools')
library(devtools)
install_github('tpoisot/digitize')
As a general rule, you don't just change the permissions of system directories! That's what root access is for. Put the permissions back the way you found them and next time run sudo R
and install.packages
from the resulting, root R shell.
Now, the reason you can't install is right there in the output you show:
ERROR: dependencies ‘httr’, ‘git2r’ are not available for package ‘devtools’
Apparently, as explained by rcs, on Ubuntu, you need to install libssl-dev
and libcurl4-openssl-dev
first.
The next issue is that your root user's R installation has /usr/local/lib/R/site-library
as the first directory in the output of .libPaths
and that is not in the paths of your regular user. Since it is the first entry for root, that's where your library was installed:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
So, a simple solution is to create a file called ~/.Rprofile
and add this line to it:
.libPaths("/usr/local/lib/R/site-library/")
Alternatively, or additionally, you could include a line like
.libPaths("/home/masi/Rlibs")
That would let you install libraries into the directory /home/masi/Rlibs
(chose whatever name you want) in future and so avoid the need for sudo R
.
Alternatively, you could set the environmental variable R_LIBS_USER
to /usr/local/lib/R/site-library/
(or /home/masi/Rlibs
or wherever else your libraries are being installed). Just add this line to your ~/.profile
:
R_LIBS_USER=/usr/local/lib/R/site-library/