I am trying to use install_github in devtools package but failing - r

I am using Sierra MacOS 10.12.6 and running rstudio 1.2.5033 and R 4.0.3 on a macbook pro from early 2015. Can anyone please let me know how to fix this issue?
First I got the following error :
Using github PAT from envvar GITHUB_PAT
Error: Failed to install 'unknown package' from GitHub:
HTTP error 401.
Bad credentials
I then unset this PAT via
Sys.unsetenv("GITHUB_PAT")
However, now I get another error as in the example below and this occurs when installing any github package, almost identically, even the "line 34" below. The dyld symbol binding and symbol not found error always occur and I also always get the same Warning in file(con, "r"). This dyld error seems to be related to the fact my OS is less than 10.13
I suppose that might answer the question but do I need to update the OS, actually?
Downloading GitHub repo jeremyrcoyle/gentmle2#HEAD
✓ checking for file ‘/private/var/folders/vf/l0sx2pbj71jdsknd5dq5p2c00000gp/T/Rtmp1Z3KtE/remotes3db121f76e4/jeremyrcoyle-gentmle2-20d253b/DESCRIPTION’ ...
─ preparing ‘gentmle2’:
✓ checking DESCRIPTION meta-information ...
Warning in file(con, "r") :
cannot open file '/var/db/timezone/zoneinfo/+VERSION': No such file or directory
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘gentmle2_0.1.0.9000.tar.gz’
dyld: lazy symbol binding failed: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
/Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 2818 Done echo 'tools:::.install_packages()'
2819 Abort trap: 6 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args}
Error: Failed to install 'gentmle2' from GitHub:
(converted from warning) installation of package ‘/var/folders/vf/l0sx2pbj71jdsknd5dq5p2c00000gp/T//Rtmp1Z3KtE/file3db4fb67c07/gentmle2_0.1.0.9000.tar.gz’ had non-zero exit status

According to the R download page, R version 4.xx requires macOS 10.13 or higher. Your two options are to update your OS or to download and install an older version of R e.g. R-3.6.3.nn.pkg (https://cran.r-project.org/bin/macosx/)

Related

installation of package ‘rmarkdown’ had non-zero exit status - How to solve that?

I am trying to install ‘rmarkdown’ in my RStudio Version 1.4.904 and R version 4.0.3 but getting the following error. I cannot open a new rmarkdown and knit a rmarkdown file. Every time I try, this message pops up,
R Markdown documents requires an updated version of the rmarkdown package. Do you want to install this package now?
Can anyone help me with that?
install.packages(ç, dependencies=TRUE)
Installing package into ‘/Users/Library/R/4.0/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
rmarkdown 2.3 2.4 FALSE
installing the source package ‘rmarkdown’
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rmarkdown_2.4.tar.gz'
Content type 'application/x-gzip' length 3202546 bytes (3.1 MB)
==================================================
downloaded 3.1 MB
Warning in file(con, "r") :
cannot open file '/var/db/timezone/zoneinfo/+VERSION': No such file or directory
dyld: lazy symbol binding failed: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _utimensat
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
/Library/Frameworks/R.framework/Resources/bin/INSTALL: line 34: 30112 Done echo 'tools:::.install_packages()'
30113 Abort trap: 6 | R_DEFAULT_PACKAGES= LC_COLLATE=C "${R_HOME}/bin/R" $myArgs --no-echo --args ${args}
Warning in install.packages :
installation of package ‘rmarkdown’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/70/lgr12kdn6wn_k36sscnc0_dw0000gn/T/Rtmpmc0jUR/downloaded_packages’```
download the binary tgz (https://cran.r-project.org/web/packages/rmarkdown/index.html) and install directly from it.
It should work. I had pretty much the same issue and I solved it that way. Keep me posted!
F
I also faced a similar problem and I spent a half-day on getting the correct solution.
Step I followed:
Uninstalled the existing version
Installed updated version of R - R version 4.0.4 (2021-02-15).
Clicked on File->New file->R markdown. It asked to install Rmarkdown packages.
Noted the packages I need to install
Typed install.packages("rmarkdown", dependencies = TRUE) on R source(can be done on R console)
Then I tried installing Rmarkdown packages individually and it worked for me. Below are the packages I needed to install.
install.packages('knitr')
install.packages('tinytex')
install.packages('base64enc')
install.packages('digest')
install.packages('jsonlite')
install.packages('htmltools')
install.packages('rmarkdown')
A somewhat more technical workaround but it worked for me.
Go to https://cran.r-project.org/ select "Packages" from the menu on the right and navigate until you find the package you need.
Download the binary.zip file for your operating system and extract the files.
Copy the extracted folder into the installation directory for your packages. It should be shown somewhere in the error messages from where you attempted to install the package originally. Replace any existing files. Restart RStudio to recognize the updated versions.

How to fix 'gcc: error: "/usr/lib64/R/library/Rhdf5lib/lib/libhdf5.a": No such file or directory' in R

I am trying to install minfi in R:
BiocManager::install("minfi")
but the installation stops during the compiling of HDF5Array with the following errors:
gcc: error: "/usr/lib64/R/library/Rhdf5lib/lib/libhdf5.a": No such file or
directory
gcc: error: "/usr/lib64/R/library/Rhdf5lib/lib/libsz.a": No such file or
directory
make: *** [HDF5Array.so] Error 1
ERROR: compilation failed for package ‘HDF5Array’
I've already installed rhdf5 and Rhdf5lib package plus the files R "can't see" actually exist in the exact directory (/usr/lib64/R/library/Rhdf5lib/lib/) where it supposedly "searches" for them.
ls /usr/lib64/R/library/Rhdf5lib/lib/
libhdf5.a libhdf5_cpp.a libsz.a
My R version is 3.6.0, my GCC version is 4.8.5 20150623 (Red Hat 4.8.5-39) and my CentOS distribution is 7.6.1810
I would appreciate any suggestions.
Thank you.
I met the same problem.
http://bioconductor.org/checkResults/release/bioc-LATEST/HDF5Array/ mentions that "HDF5Array(1.12.2)" failed to be installed. So wait for improvements.
There is a way: installing an older version of "HDF5Array".
url<-"https://bioconductor.org/packages/3.8/bioc/src/contrib/HDF5Array_1.10.1.tar.gz"
install.packages(url,repos=NULL,type="source")
BiocManager::install("minfi")

Error in installing car package in R

While installing "car" package in Rstudio in Ubuntu, I faced an error saying that dependencies "nloptr","lme4" and one more, are not installed.
So I started installing "nloptr" but I faced this error-
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-
2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to
/tmp/RtmpSeLv7g/R.INSTALL18a67910d582/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
System hangs after last line and when I restart after some time, "nloptr" is not installed and hence I am unable to install "car" package.
Please help me. Thanks in advance.
I was encountering the same problem under R (pure R 3.2.3 on Linux Debian). I was first blocked by another issue during the same installation : the installation process failed to lock directory ~/.../R/x86_64.../3.2 and suggested to remove ~/.../R/x86_64.../3.2/00LOCK-nloptr . I did it, restart the car package installation, and then it blocked at the same point: it needs nlopt.h.
So, I installed libnlopt-dev (sudo apt-get install libnlopt-dev) and re-restart the car installation ... and then it worked.
Ok, this is under linux, but perhaps should you try to focus on installing something about NLOPT under windows.
Good luck.

How to install R-packages not in the conda repositories?

I am using Anaconda to manage my R-installation. It works great for packages available in the R-channels provided by Anaconda, but I am having troubles installing packages not contained in the Anaconda repos.
I have tried a few different approaches, all listed below together with their error output.
1. install.packages('rafalib')
Suggested to work here conda - How to install R packages that are not available in "R-essentials"?. My .libPaths() points to '/home/user/anaconda2/lib/R/library'.
Out:
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) :
unsupported URL scheme
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.18/library ./tcl8.5.18/library
This probably means that Tcl wasn't installed properly.
I installed tcl from the conda channel r-old, but install.packages() still threw the same error message.
2. options(menu.graphics=FALSE) and then install.packages('rafalib')
I got a list of mirrors and chose one.
Out:
Selection: 15
trying URL 'http://cran.utstat.utoronto.ca/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/Rtmphwpta0/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
Both 2 and 3 are from Disable/suppress tcltk popup for CRAN mirror selection in R
3. Setting the mirror in ~/.Rprofile
Before trying install.packages(), I added the following to my ~/.Rprofile.
## Default repo
local({r <- getOption("repos");
r["CRAN"] <- "http://cran.us.r-project.org";
options(repos=r)})
Out:
trying URL 'http://cran.us.r-project.org/src/contrib/rafalib_1.0.0.tar.gz'
Content type 'application/x-gzip' length 11798 bytes (11 KB)
==================================================
downloaded 11 KB
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
The downloaded source packages are in
‘/tmp/RtmppIz9rT/downloaded_packages’
Warning message:
In install.packages("rafalib") :
installation of package ‘rafalib’ had non-zero exit status
4. Setting the download method to 'curl' or 'wget'.
While keeping the new ~/.Rprofile configuration. I guess this wasn't necessary since the package seems to be downloading fine now, but I tested it just in case.
Out:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning in download.packages(pkgs, destdir = tmpd, available = available, :
download of package ‘rafalib’ failed
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
download had nonzero exit status
5. Manual download of rafalib
install.packages('../Downloads/rafalib_1.0.0.tar.gz', repos=NULL, type='source')
Out:
sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook
Warning message:
In install.packages("../Downloads/rafalib_1.0.0.tar.gz", repos = NULL, :
installation of package ‘../Downloads/rafalib_1.0.0.tar.gz’ had non-zero exit status
6. Building a conda package from rafalib
I opened a separate issue for this Errors building R-packages for conda. In short, it complains about missing dependencies that I already have installed. Update I got a round the dependency problem and I am now stuck at the same rl_signal_event_hook-error as for my other approaches.
7. sudo ln /usr/lib/libncursesw.so.6 /usr/lib/libncursesw.so.5
As per https://github.com/conda/conda/issues/1679, but it didn't fix the issue for me.
So it seems like I can now download the package fine, but installing it fails. I have seen the error message sh: symbol lookup error: sh: undefined symbol: rl_signal_event_hook previously when using R with irkernel in the Jupyter Notebook, but it has never obstructed my work. I have never seen anything relating to that error message when running python through anaconda.
I'm out of ideas. Does anyone know how I can install R-packages not provided by anaconda, such as rafalib or swirl?
I am on Linux (Antergos, an Arch derivative) with kernel 4.4.5-1-ARCH.
UPDATE 2016/04/15
There is some related discussion in this thread. I have tried to get around this error by installing different versions of ncurses, including this patched version, and I have tried to link the readline libraries, as suggested here, but I keep running into the same error. I'm quite lost at this point and any help to solve this would be greatly appreciated.
Detailed post on managing packages that are and are not in Anaconda R: http://ihrke.github.io/conda.html
Essentially is using commands:
conda skeleton cran <package_name>
conda build <package_name>
If the package has dependencies that are also not in Anaconda:
conda skeleton cran <dependency1>
conda skeleton cran <dependency2>
conda build <package_name>
Essentially I would agree with this post in saying that I don't understand how install.packages() works with Anaconda. What I seem to see is that Anaconda creates a R environment where all the packages installed from install.packages() are kept.
Whenever I am working in Jupyter with R, I use this environment and am able to access all the packages that I have installed with install.packages()
In the end, I got around the rl_event_hookproblems by following the approach recommended here and symlinking anaconda's libreadline to the system one:
mv ~/anaconda3/lib/libreadline.s.6.2 ~/anaconda3/lib/libreadline.s.6.2.bak
ln -s /usr/lib/libreadline.so.6.3 ~/anaconda3/lib/libreadline.s.6.2
I am still having troubles installing some dependency heavy R-packages due to failure to load shared objects when using install.packages() from withing R. However, simpler packages work fine and I can get most of the dependency heavy packages from anacondas R-repositories.

openNLP on a mac

I am not familiar with Mac (I use Windows and Linux Mint) but have a package that I need to be able to tell people on all platforms how to build. This package relies on openNLP and because of encoding issues with the MacOS X does not install via install.packages("openNLP").
I have had people tell me you can still install using install.packages("openNLP", type="source") but I get the following message:
> install.packages("openNLP", type="source")
trying URL 'http://cran.rstudio.com/src/contrib/openNLP_0.0-8.tar.gz'
Content type 'application/x-gzip' length 807784 bytes (788 Kb)
opened URL
==================================================
downloaded 788 Kb
* installing *source* package ‘openNLP’ ...
/Library/Frameworks/R.framework/Resources/bin/config: line 142: make:
command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 143: make:
command not found
/Library/Frameworks/R.framework/Resources/bin/config: line 219: make:
command not found
Could not determine the Java interpreter.
Maybe run R CMD javareconf?
ERROR: configuration failed for package ‘openNLP’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/openNLP’
The downloaded source packages are in
‘/private/var/folders/YW/YWal638NEwi-tFse3NsBFk+++TM/-Tmp-/RtmpaWdKnC/downloaded_packages’
Warning message:
In install.packages("openNLP", type = "source") :
installation of package ‘openNLP’ had non-zero exit status
So I use Mac''s temrinal to do the suggested R CMD javareconf:
Java interpreter : /usr/bin/java
Java version : 1.6.0_37
Java home path :
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path:
JNI linker flags : -framework JavaVM
JNI cpp flags : -I$(JAVA_HOME)/include
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
And try closing out R, re-opening and then install.packages("openNLP", type="source") but the same message occurs. Google has not helped me here and I am very unfamiliar with Mac. I assume it has to do with the type of java installed but know too little about Mac to play aimlessly as this is not my Mac machine.
Please direct me with getting openNLP to install correctly.
I just compiled from source on Mas OSX 10.6.8 with R 2.15.2 with no error. Given the fact that the error message says make cannot be found, it sounds as though that machine is not yet set up to compile from source. Do you understand that XCode is not installed by default and that you need to acquire it from Apple in order to compile "source" packages?

Resources