I just ran the following command after running R CMD build pkg and R CMD check pkg and it completed without errors.
R CMD install -t /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1 pkg_0.1.0.tar.gz
However, I still can't use it via library(pkg) from R. Looking in the library directory, all I see is the tarball, no pkg directory. When I try and untar it and then load in R, I get the error:
Error in library(e2pa) : 'e2pa' is not a valid installed package
Alternatively, when I try to install with
R CMD install -l /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1 pkg_0.1.0.tar.gz
It tells me -l is an invalid option.
Another failed possibility:
R CMD install -t /home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1/pkg pkg_0.1.0.tar.gz
install: accessing `/home/wdkrnls/R/x86_64-unknown-linux-gnu-library/3.1/pkg': No such file or directory
What is the right way to install a package into a personal library in R?
Unix commands are case-sensitive and
R CMD install ....
as you typed invokes a different /usr/bin/install than the R-internal script INSTALL which the actually mandated form
R CMD INSTALL ...
uses. See all the relevant docs -- it is always UPPERCASE.
Once you have the correct script, -l ... is recognised:
edd#max:~$ R CMD INSTALL -l /tmp/demo git/drat_0.0.2.4.tar.gz
* installing *source* package ‘drat’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (drat)
edd#max:~$
Related
I have a shiny project using packrat. When I create a Rocker-shiny Docker container I put commands in Dockerfile in order to install packrat package and restore library. However, I see that packrat installs packages into system library (/usr/local/lib/R/...) instead private project library. If I enter in bash docker's console and I start a R session into project dir then reads .Rprofile file and packrat is installed and starts packages installation into private library. How I can get this from Dockerfile?
In my Dockerfile:
RUN cd /srv/shiny-server && \ R -e 'install.packages("packrat" , repos="http://cran.us.r-project.org"); packrat::restore()'
Install packages into /usr/local/lib/R... what is wrong.
However, if I enter into docker bash and start a R session into my project dir, it works fine:
docker exec -it test_app bash
cd /srv/shiny-server
R # start R session into project dir
Packrat is not installed in the local library -- attempting to bootstrap an installation...
> Installing packrat into project private library:
- "/srv/shiny-server/packrat/lib/x86_64-pc-linux-gnu/3.5.3"
* installing *source* package ‘packrat’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (packrat)
> Attaching packrat
> Restoring library
Installing plyr (1.8.1) ... OK (built source)
I encountered the same problem and fixed the issue by restoring the packrat packages in my docker-compose file:
docker-compose.yml:
...
command: [sh,-c, "sudo Rscript config/packrat_restore.R"]
...
packrat_restore.R:
packrat::init(
infer.dependencies = FALSE,
enter = TRUE,
restart = FALSE)
packrat::restore()
As this workaround will always delay the startup of my containers in production, I will still try to fix the problem in the Dockerfile itself...
Short question: I want to edit the postgresqlWriteTable function in the RPostgreSQL package and install it on R running on an Ubuntu machine.
Long explanation:
The root of my problem is that I am trying to write to a postgres table with an auto-incrementing primary key column from R using dbWriteTable from RPostgreSQL package.
I read this post: How do I write data from R to PostgreSQL tables with an autoincrementing primary key? which suggested a fix to my problem by changing the function postgresqlWriteTable in the RPostgreSQL package. It works when I interactively use fixInNamespace in OSX environment and edit the function.
Unfortunately I have to run my script on an AWS instance running R on Ubuntu. I have RPostgreSQL installed at this location on my machine: /usr/local/lib/R/site-library/RPostgreSQL . I installed it by invoking R CMD install RPostgreSQL_0.4-1.tar.gz
Now I am trying to find the function postgresqlWriteTable. It is supposed to be in the file PostgreSQLSupport.R . I have searched the whole library - there is no such file.
I realized that on my local machine in the OSX Finder , when I unzip the tar.gz package folder, I can see the file PostgreSQLSupport.R where I am supposed to change the function.
So I changed the function. Then I removed the installed RPostgreSQL from my Ubuntu machine and copied the new folder (from my local machine) into my Ubuntu machine and tried to use devtools to install the package as suggested in the post here: Loading an R Package from a Custom directory
here's what happened:
> library("devtools")
> install("/usr/local/lib/R/site-library/RPostgreSQL")
Error: Can't find '/usr/local/lib/R/site-library/RPostgreSQL'.
> install("RPostgreSQL", "/usr/local/lib/R/site-library/RPostgreSQL")
Installing RPostgreSQL
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \
CMD INSTALL '/datasci/nikhil/RPostgreSQL' \
--library='/usr/local/lib/R/site-library' --install-tests
* installing *source* package ‘RPostgreSQL’ ...
file ‘R/PostgreSQLSupport.R’ has the wrong MD5 checksum
ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual'
* removing ‘/usr/local/lib/R/site-library/RPostgreSQL’
Error: Command failed (1)
I am at my wit's end !
Copy the pacakge .tar.gz file to the AWS machine.
Unpack this file so you have a directory structure.
Edit the function inside the file and save your changes.
You may also have to increase the version number in the DESCRIPTION file.
Use devtools::build to create a new .tar.gz file.
Install this updated version of the package.
I am trying to install a package called gpusvcalibration from Github.
library("devtools")
install_github("mfrdixon/gpusvcalibration")
And I get the following error:
Error: Command failed (1)
Anyone know what is going on?
Have you read the installation instructions from the repo and followed them?
Clone the repository and then
Modify the R_EXE and R_INCLUDE variables in the Makefile
R CMD build gpusvcalibration
R CMD check gpusvcalibration
R CMD install gpusvcalibration_0.0-1.tar.gz
install.packages('gpusvcalibration_0.0-1.tar.gz', repo=NULL)
I'm using R version 3.0.2 on my Windows 7 (32-bit) system and am stumped trying to install rCharts. I've had no problem installing other packages from github (e.g., slidify), but R seems unable to find the dependent RCurl package I installed.
I can submit the following basic lines of code without error:
require(devtools)
library(bitops,lib.loc='c:/R/packages/')
library(RCurl,lib.loc='c:/R/packages/')
require(RCurl) # have also tried the library function without luck*
But, when I submit the command to install rCharts with
install_github('rCharts', 'ramnathv')
I get the following :
Installing github repo(s) rCharts/master from ramnathv
Downloading rCharts.zip from https://github.com/ramnathv/rCharts/archive/master.zip
Installing package from C:\Users\nakamura\AppData\Local\Temp\RtmpwzYzaG/rCharts.zip
Installing rCharts
"C:/PROGRA~1/R/R-30~1.2/bin/i386/R" --vanilla CMD INSTALL \
"C:\Users\nakamura\AppData\Local\temp\RtmpwzYzaG\rCharts-master" \
--library="C:/Program Files/R/R-3.0.2/library" --with-keep.source \
--install-tests
**ERROR: dependency 'RCurl' is not available for package 'rCharts'**
*** removing 'C:/Program Files/R/R-3.0.2/library/rCharts'
Error: Command failed (1)**
I've tried installing libcurl, but am not sure I've unzipped it to the correct folder. (From what I've been able to gather from bits and pieces of other questions about rCurl, it seems having an improper/no installation of libcurl could be a contributing factor?)
Any help would be very much appreciated. I feel like I'm going around in circles.
Ann
Adding the directory "C:/R/packages" to the front of the .libPaths variable will help R find RCurl if it's been installed to a non-standard directory.
Issue:
I'm just trying to build a few packages from source and am running into an error
Error: unexpected symbol in "tools:::.test_load_package('rbenchmark',
'\per-homedrive1.corp.something.org/homedrive$/Tommy.O'Dell"
Full output below:
C:\ROracle>R CMD INSTALL --build --merge-multiarch rbenchmark_1.0.0.tar.gz
install for i386
* installing to library '\\per-homedrive1.corp.something.org/homedrive$/Tommy.O'Dell/R/win-library/2.15'
* installing *source* package 'rbenchmark' ...
** package 'rbenchmark' successfully unpacked and MD5 sums checked
** R
** demo
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: unexpected symbol in "tools:::.test_load_package('rbenchmark', '\\per-homedrive1.corp.something.org/homedrive$/Tommy.O'Dell"
Execution halted
ERROR: loading failed
* removing '\\per-homedrive1.corp.something.org/homedrive$/Tommy.O'Dell/R/win-library/2.15/rbenchmark'
Question:
Is the error coming from the apostrophe (') from O'Dell in the path?
If yes, is it a bug since it isn't escaping the apostrophe in the directory?
Is it trying to install into my default library?
If yes, can I change the library as a parameter in R CMD INSTALL?
If I can't specify the library, should I remove that library altogether?
Extra Info:
Here's the output of .libPaths()
[1] "\\\\per-homedrive1.corp.something.org/homedrive$/Tommy.O'Dell/R/win-library/2.15"
[2] "C:/Program Files/R/R-2.15.2/library"
[3] "C:/Program Files/RStudio/R/library"
As I see it, the error comes from the apostrophe - R can't know that this doesn't end the path, but is part of it. Try it without it and it should work I guess. One solution might be also to use this kind of quotation instead " ", maybe this works out as well, because then the apostrophe doesn't end it any more...
EDIT: In order to install a package foo via command line to an specific library folder via command line you can use
R CMD build foo
R CMD INSTALL -l /home/daniel/myPkg/ foo_1.0.tar.gz
This means in your case this should work:
R CMD INSTALL --build --merge-multiarch -l C:/Program Files/RStudio/R/library rbenchmark_1.0.0.tar.gz