conda build R packages to different library location - r

I'm following the instructions from https://www.continuum.io/content/conda-data-science in order to build a CRAN-available R package (e.g. synthpop).
conda skeleton cran synthpop
conda build r-synthpop
How can I change the default conda build sequence to install to a different library location, as I don't have permission to install to the default one?
* installing to library ‘/path/to/default/lib’
Error: ERROR: no permission to install to directory ‘/path/to/default/lib’
Also, I'm running conda build from within a virtual env.
Raised this as an issue here: https://github.com/ContinuumIO/anaconda-issues/issues/1562

Hi I was faced with this similar problem recently. After some researches, I wrote one passage about it
https://github.com/alfredzj/Documentations/blob/master/anaconda-set-up.md
I don't think changing location is a good idea.

The --croot option allows installs to a specific location:
conda build --croot /path/to/somewhere/env r-synthpop/
In our case we had two R installs, and the configuration in .Rprofile listed a library location which had restricted write permissions. This location masked the path we gave via --croot. Once we edited .Rprofile we could run conda build with the desired path.

Related

Installing R packages in macOS Mojave: Error in if (nzchar(SHLIB_LIBADD))

I have been trying to install R packages directly from the terminal but I am struggling much more than setting up the libraries I want in Windows. Sometimes it works if I install every single dependency for more complex packages by downloading them from CRAN and placing them in the R folder.
I appreciate this is not efficient but the recurrent error if I run R within the terminal while installing some of the packages is the following:
** libs
Error in if (nzchar(SHLIB_LIBADD)) SHLIB_LIBADD else character() :
argument is of length zero
* removing ‘/anaconda3/lib/R/library/<package name>’
[...]
In install.packages("<package name>") :
installation of package ‘fpc’ had non-zero exit status
I have been looking across many forums but the only solution I found so far is to install single dependencies manually by downloading them and dropping them in the master R folder. It is taking way longer than expected.
Any suggestion will be appreciated. Thanks
in my case (centos 7):
/home/xilab/miniconda3/lib/R/etc/Makeconf is a empty file!
find ~ -name Makeconf
/home/xilab/miniconda3/pkgs/r-base-3.6.1-hce969dd_0/lib/R/etc/Makeconf
/home/xilab/miniconda3/pkgs/r-base-3.6.1-h8900bf8_2/lib/R/etc/Makeconf
/home/xilab/miniconda3/envs/python2.7/lib/R/etc/Makeconf
/home/xilab/miniconda3/lib/R/etc/Makeconf
/home/xilab/miniconda3/pkgs/r-base-3.6.1-hce969dd_0/lib/R/etc/Makeconf is not empty,so:
mv /home/xilab/miniconda3/lib/R/etc/Makeconf /home/xilab/miniconda3/lib/R/etc/Makeconf.backup
cp /home/xilab/miniconda3/pkgs/r-base-3.6.1-hce969dd_0/lib/R/etc/Makeconf /home/xilab/miniconda3/lib/R/etc/Makeconf
problem solved!
I have seen this problem in conda version of R where /yours/anaconda/environment/lib/R/etc/ has a file Makeconf.mro.original together with an empty Makeconf file. This should not be intended.
During installation of some packages R checks what is within this Makeconf file, one such check is for SHLIB_LIBADD.
I just backed up the empty (or whatever) Makeconf file. Then copied Makeconf.mro.original to Makeconf.
This solved my case.
EDIT:
Recently I saw in centos-machine that Makeconf.mro.original file is not made after install.packages("name of library") failed. There is no easy solution for this.
In my case R installation was inside a conda environment. So, I created a new conda environment with R installation. The fresh installation has a Makeconf file in etc directory. So, I copied the Makeconf file from fresh R to my previously working R's etc directory.
It may be better to keep a backup copy of Makeconf from etc to a Makeconf.bak for future problems, in your working R etc directory.
I hope this helps for some cases.
I had this problem when trying to run install.packages("RPostgres") in a conda-installed version of R . The solution was to use conda as the package manager instead of R's install.packages function. That meant running these commands at a normal system command prompt (not in R):
conda search -c conda-forge RPostgres
# shows various versions of r-rpostgres
conda install -c conda-forge r-rpostgres

libtinfow.so.6: cannot open shared object file: No such file or directory

Conda was used to install R in my centos 7 sysytem. conda install r
the version of installed r is r-3.4.1.
However, when I use r, there have a error output. "/usr/local/bin/miniconda3/lib64/R/bin/exec/R: error while loading shared libraries: libtinfow.so.6: cannot open shared object file: No such file or directory"
Some tests have been used according to search by google use the keyword "libtinfow.so.6".
Only two information can be found. They have no help to me.
enter image description here
I had the same problem on a recent centos installation. But I think this has nothing to do with centos, but rather to misconfiguration related to different R packages version. To solve the problem, I just uninstall all the R related packages and gxx and gcc packages using "conda uninstall ". Than I installed R using "conda install -c r r", which force to install gcc and gxx within the same process.

How to specify lib directory when installing development version R Packages from github repository

In Ubuntu, I am installing all the R packages in the directory, /usr/lib/R/site-library by specifying lib option in install.packages().
But when I try to install the development version of the R packages using, install_github(), it always installs in a local repository of the system user.
.libPaths() has 4 directories including the local repository. So, I have 2 questions,
Will it install in any of the other 3 repositories if i remove the local repository from .libPaths()?
Is there any way to specify installation library path in install_github()?
I am using Ubuntu 12.04 64bit and R 3.0.1
----------------------UPDATE--------------------------------
Unable to remove the local repository from .libPaths()
If I try to install using install_github() in RStudio, it installs in the local repository since lib is not specified.
If I try to install using install_github() as non-root user, it installs in the local repository since lib is not specified.
If I try to install using install_github() as root user, it installs in the /usr/local/lib/R/site-library since lib is not specified.
Is there any to specify installation lib?
To add specified library paths in devtools, we need to use with_libpaths()
Arguments for with_libpaths() are, with_libpaths(new, code)
Following is an example for using with_libpaths(),
library(devtools)
with_libpaths(new = "/usr/lib/R/site-library/", install_github('rCharts', 'ramnathv'))
Courtesy: Hadley, here :)
And other than with_libpaths(), there are more options for in devtools::with_something()
in_dir: working directory
with_collate: collation order
with_envvar: environmental variables
with_libpaths: library paths, replacing current libpaths
with_lib: library paths, prepending to current libpaths
with_locale: any locale setting
with_options: options
with_path: PATH environment variable
with_par: graphics parameters
More explanations here
install_github takes a ... argument that passes to devtools::install. devtools::install has an args argument.
args
An optional character vector of additional command line arguments to be passed to R CMD install. This defaults to the value of the option "devtools.install.args".
R CMD install takes a library argument
Options:
-h, --help print short help message and exit
-v, --version print INSTALL version info and exit
-c, --clean remove files created during installation
--preclean remove files created during a previous run
-d, --debug turn on debugging messages
and build a debug DLL
-l, --library=LIB install packages to library tree LIB
So the following should work:
devtools::install_github("repo", args = c('--library="./mypath/gdfgdg/"'))
however it doesnt appear to be replacing the call to R CMD install
"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" --vanilla CMD INSTALL \
"C:\Users\john\AppData\Local\Temp\RtmpucrXMD/RSelenium_1.3.2.tar.gz" \
--library="C:/Users/john/Documents/R/win-library/3.1" --install-tests \
--library="C:/Users/john/Desktop/"
This is more of a workaround, but I found a way using the command-line version of R.
Starting from Ubuntu:
sudo -i R
the trick (I found) is to use -i option
Then from R:
.libPaths()
my local R directory does not appear; the default directory is the one that I want.
Then, I install.packages() or install_github() with impunity.
Hope this helps,
Ian

R install package globally

How do I install an R package globally, so it's available to all users? Currently I'm doing
R.exe CMD INSTALL *.zip
But it does
* installing to library 'C:/Users/Matt/Documents/R/win-library/2.15'
I would like to install the packages alongside R in Windows' 'program files'.
Your big problem here is installing to C:\Program Files\. This means on versions of windows with file permissions, you need admin permissions to write to that folder. As R does not commonly request admin permissions, it will on default install to an user subdirectory, unless you run R as administrator (by right clicking on the shortcut). In which case you can use the GUI to install packages and it will install them globally by default. For working on the command line, you can also run the cmd session as administrator.
In future, it's recommended that you install R to say, C:\R\ to avoid this.
What worked for me was running:
install.packages("MyPackage", lib="C:\\Program Files\\R\\R-3.0.1\\library")
Installing it to Program Files wasn't a problem for me - the problem was that the default installation directory was in C:\\Users\\Mike\\Documents\\R\\...
Ultimately you just want to install it to wherever .libPaths() looks by default, and in my environment that was most commonly C:\\Program Files\\R\\R-3.0.1\\library
Here is a way to specify where to find or install libraries. You can put the libraries in a common directory.
http://cran.r-project.org/doc/manuals/R-admin.html#Managing-libraries

my RPM package requires 2 already installed shared libraries

I'm looking for help about making rpm packages.
I just created my first RPM package with rpmbuild.
This package is simple. It has just to copy several config files and one executable.
I cannot install this .rpm because 2 shared librairies used by the executable are required.
These librairies are already installed but they are not linked with another .rpm package because I build them from one of my projects. There are located in the /usr/myproject/lib directory.
I tried to put symbolic links to /lib and /usr/lib, tried also to run a "ldconfig" update from a .conf file which contains the /usr/myproject/lib directory, and tried to update the LD_LIBRARY_PATH env variable without any success.
I know I can ignore dependencies using the -nodeps command line option but I'd like in the next step to create my own yum repository but yum do not allow to install a package if the dependencies are not fulfilled.
I would also prefer to keep the automatic dependency feature of rpmbuild enabled.
Thanks in advance.
Package these 2 libraries in another RPM, then you can install both RPMs in one rpm -i call.

Resources