R unable to load internet routines after upgrade to MacOS Sierra - r

When running R after upgrading my mac to 10.12.6 (Sierra), R can no longer load libraries or access anything on the internet:
> install.packages("devtools")
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (internet routines cannot be loaded); using local file '/anaconda/lib/R/doc/CRAN_mirrors.csv'
[...]
Warning: unable to access index for repository
https://cran.cnr.berkeley.edu/src/contrib:
internet routines cannot be loaded
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/anaconda/lib/R/modules//internet.so':
dlopen(/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /anaconda/lib/R/modules//internet.so
Reason: image not found
2: package ‘devtools’ is not available (for R version 3.4.1)
Similarly:
> source("https://bioconductor.org/biocLite.R")
Error in file(filename, "r", encoding = encoding) :
internet routines cannot be loaded
In addition: Warning message:
In file(filename, "r", encoding = encoding) :
unable to load shared object '/anaconda/lib/R/modules//internet.so':
dlopen(/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /anaconda/lib/R/modules//internet.so
Reason: image not found
This happens both when I run R from Terminal and when I run R from RStudio (though RStudio only gives me the error, not the warning, and then still fails).
I found other people with vaguely similar problems in the past; one common solution was to re-install XQuartz, which I have done, but which didn't help.
Another common solution was to update LD_LIBRARY_PATH. However, 'libssh2.1.dylib' does not seem to exist: 'locate libssh2.1.dylib' returns nothing. I did find libssh2.dylib in /Applications/Xcode.app/Contents/Developer/usr/lib/libssh2.dylib, which is presumably the same thing, but R isn't finding it, I suppose.
Any ideas? Thank you!

EDIT: I found a simple solution. Just download the .tar file and use the command 'R CMD INSTALL mcmcse_1.3-2.tar', for example, in your terminal, from the directory in which your .tar file is saved.
I think that install.packages(‘package_name’) not working within R on macOS Sierra (with the package manager Anaconda installed) might be because Anaconda moves R’s path.
Just a reply to flag the same issue while using Anaconda 4.2.0 with R 3.4.1 on macOS Sierra 10.12.6. I was initially running R 3.4.0 in /usr/bin/R, but R has since become R 3.4.1 in /Users/[username]/anaconda/bin/R after installing Anaconda 4.2.0.
Warning: unable to access index for repository https://www.stats.bris.ac.uk/R/src/contrib:
internet routines cannot be loaded
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
unable to load shared object '/Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so':
dlopen(/Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so, 6): Library not loaded: #rpath/libssh2.1.dylib
Referenced from: /Users/michaelfaulknerlocal/anaconda/lib/R/modules//internet.so
Reason: image not found
2: package ‘mcmcse’ is not available (for R version 3.4.1)

This turns out to be, as far as I can tell, a bug in Anaconda2-4.4.0-MacOSX-x86_64.pkg I had an anaconda/ directory in /, /Applications/, and /Users/[me]/: I deleted all of them, and removed the Anaconda PATH change to .bash_profile. R then reverted to /usr/local/bin/R, which did not have the internet connection problems reported above. Then I reinstalled Anaconda from scratch, then installed RStudio from Anaconda-Navigator. 'which R' now pointed at /Users/[me]/anaconda/bin/R (the PATH having changed again upon install), and which had the internet connectivity problem. Running /usr/local/bin/R directly, even with Anaconda installed, had no problems.
I've filed the bug as https://github.com/Anaconda-Platform/support/issues/137 but now can at least run R myself by using /usr/local/bin/R.

Related

Install two versions of rtools

I have R version 4.0.2 and Rtools40 installed in windows on the local disk C:\. I recently installed Microsoft R Client version 3.5.2, in the local disk E:\. My question is how can I install Rtools35.exe on the E:\ disk without interfering with the Rtools40 variable environment?. In other words, I want to have both versions of rtools and that they work without problems, Thanks.
When switching to R 3.5.2, rtools does not work.
library(Rcpp);
evalCpp("2 * M_PI")
Error in system(cmd, intern = !showOutput) : 'E:/Program' not found
Error in system(cmd, ignore.stderr = TRUE, intern = TRUE) :
'E:/Program' not found
R 4.0.2 works
library(Rcpp);
evalCpp("2 * M_PI")
6.283185
Read the instructions at this page It should not be too hard to set up your two installation of R (4.0 and 3.6.X) so that each one queries a different .Renviron file and thus sets up a different path to the desired Rtools repository.
The problem was due to the fact that Microsoft R Client version 3.5.2, was installed in a path with space E:\Program Files\Microsoft\R Client, it was solved by installing it in a path without spaces E:\Microsoft\R-Client, such as suggested in: Message error 'C:/Program' not found with Rcpp

Problem with installing RQDA package since it was archived 20/05/2020

I receive an error when installing RQDA on Windows 10.
I had run RQDA successfully, then a package wouldn't load and I deleted and tried to reinstall RQDA with these instructions: http://rqda.r-forge.r-project.org/.
Since then, I receive errors pointing towards RGtk2 and GTK+.
I tried loading RQDA both using the newest and older versions of R and RStudio. I tried on 3 different Windows computers.
Here is the link that shows the RQDA package was recently archived:
https://cran.r-project.org/web/packages/RQDA/index.html
The archive points towards requiring gWidgets, so I made sure the library of gWidgets loads successfully, which it does, as does library(gWidgetsRGtk2).
I also took care to install RTools4.0 for R 4.0.0 (https://cran.r-project.org/bin/windows/Rtools/).
I made sure GTK+ is on my PATH. (Path: %GTK_BASEPATH%\bin;) (GTK_PATH: C:\GTK).
I also tried loading RQDA and dependencies manually, but that's a never ending process.
Here is the error I receive:
Failed to load RGtk2 dynamic library, attempting to install it.
Please install GTK+ from http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
Error in getOption("encoding") : Knotenstack-Überlauf
Zusätzlich: Warnmeldung:
Failed to load RGtk2 dynamic library, attempting to install it.
Please install GTK+ from http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
Error: package or namespace load failed for 'RGtk2':
.onLoad in loadNamespace() für 'RGtk2' fehlgeschlagen, Details:
Aufruf: NULL
Fehler: Knotenstack-Überlauf
Fehler: Paket 'RGtk2' konnte nicht geladen werden
Zusätzlich: Warnmeldung:
Failed to load RGtk2 dynamic library, attempting to install it.
Ausführung angehalten
ERROR: lazy loading failed for package 'RQDA'
* removing 'C:/Users/haunschild/Documents/R/win-library/4.0/RQDA'
Warning in install.packages :
installation of package ‘RQDA_0.3-1.tar.gz’ had non-zero exit status
Trying to install RGtk2, I receive the following:
Error in inDL(x, as.logical(local), as.logical(now), ...) :
kann shared object 'C:/Users/haunschild/Documents/R/win-library/4.0/RGtk2/libs/x64/RGtk2.dll' nicht laden:
LoadLibrary failure: %1 ist keine zulässige Win32-Anwendung.
versuche URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip'
Content type 'application/zip' length 25830230 bytes (24.6 MB)
downloaded 24.6 MB
Learn more about GTK+ at http://www.gtk.org
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
Lade nötiges Paket: cairoDevice
Warnmeldungen:
1: Failed to load RGtk2 dynamic library, attempting to install it.
2: In dir.create(config_path, recursive = TRUE) :
'C:\Users\haunschild\Documents\R\win-library\4.0\RGtk2\gtk\x64\etc\gtk-2.0' existiert bereits
> detach("package:RGtk2", unload = TRUE)
Fehler: Paket ‘RGtk2’ wird von ‘gWidgetsRGtk2’ benötigt, wird deshalb nicht detached ("Is needed by gWidgetsRGTk2', is therefore not detached")
> library(RGtk2)
I also tried:
pkgFile <- "RQDA_0.3-1.tar.gz"
download.file(url = url, destfile = pkgFile)
# Install dependencies
install.packages(c("DBI","RSQLite","RGtk2","gWidgets","gWidgetsRGtk2"))
# Install package
install.packages(pkgs=pkgFile, type="source", repos=NULL)
# Delete package tarball
unlink(pkgFile)
An received the same RGTk2 error loop.
Any help would be greatly appreciated! Thanks!
I've got RQDA working in Windows after:
install.packages(c("gWidgets", "RGtk2", "igraph","plogr","bit","RSQLite"),depen=T)
To install "gWidgetsRGtk2" it was needed:
Download GTK+: http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip
Create an empty folder like c:\opt\
Unzip the content of that file in the folder created. You'll have something like c:\opt\gtk+-bundle_2.22.1-20101227_win32. The name of this folder can be changed.
Then add c:\opt\gtk+-bundle_2.22.1-20101227_win32\bin to your PATH
To add the bin folder to the PATH: right-click on "My Computer" and select "Properties", then "Advanced" tab, then "Environment Variables". Select the "PATH" variable and then "Edit" Add "c:\opt\gtk+-bundle_2.22.1-20101227_win32\bin" to the items in the PATH variable.
PS. Make sure you have no other versions of GTK+ in PATH.
So You can run the following code:
url <- "https://cran.r-project.org/src/contrib/Archive/gWidgetsRGtk2/gWidgetsRGtk2_0.0-86.tar.gz"
pkgFile <- "gWidgetsRGtk2_0.0-86.tar.gz"
download.file(url = url, destfile = pkgFile)
install.packages(pkgs=pkgFile, type="source", repos=NULL)
Once the "gWidgetsRGtk2" is installed, you can run the following command to install RQDA:
install.packages("RQDA",repos="http://R-Forge.R-project.org", type="source")
REFERENCES
https://rqda.r-forge.r-project.org/
https://github.com/krlmlr/r-appveyor/issues/48
We've been discussing this issue at : https://github.com/Ronggui/RQDA/issues/38
Some have reported success installing it and have given feedback on how to do it.
Some contributors are working to port RQDA to gWidgets2. May be one of their solutions works for you.
Good luck.
After I gave the answer above I tryed to install it my self and this was as far as I've got using RKWard 0.7.1b, on VM with MsWins10.
https://rkward.kde.org/
with R 3.6.3 in RKWard library (I had RQDA working before. So I uninstalled RKWard and deleted the library directory on C:\Program Files):
https://cran.r-project.org/bin/windows/base/old/3.6.3
and RTools35
https://cran.r-project.org/bin/windows/Rtools/history.html
also installed.
install.packages(c("gWidgets", "gWidgetsRGtk2", "RGtk2", "igraph","plogr","bit","RSQLite"),depen=T)
update.packages(ask = FALSE, checkBuilt = TRUE)
library(RGtk2)
Selected GTK+
Restarted RKWard
Installing ""RQDA_0.3-1.tar.gz", type = "source"", gave me an error: "Failed to load RGtk2 dynamic library, attempting to install it". But by chance, I just saw the post by #JanMarvin and it worked!!!
install.packages("https://cran.r-project.org/src/contrib/Archive/RQDA/RQDA_0.3-1.tar.gz", type = "source", INSTALL_opts = "--no-multiarch")
Then I ran:
update.packages(ask = FALSE, checkBuilt = TRUE)
And then
library (RQDA)
And it worked!!
If anyone could please refine it or give other suggestions as how to install it on MsWin, would be very much appreciated!
Thanks to #sjewo and #JanMarvin for their hard work!! porting this package to R 4.
These steps update the previous to install RQDA. I'm using Windows 10, and this code was run on April-17, 2021:
Use R version 3.6.3, 32 bits. If possible, also install Rstudio;
Run install.packages("gWidgets", repos="http://R-Forge.R-project.org");
Run install.packages(c("RGtk2","igraph","plogr","bit","RSQLite","cairoDevice"),depen=T);
Run library("RGtk2") . An error message will appear, asking you to install GTK+. Select it and press OK;
Restart R. Then run library("RGtk2") again to see if everything is OK;
Create the folder C:\GTK;
Go to https://download.gnome.org/binaries/win32/gtk+/2.22/ and download the file gtk+-bundle_2.22.1-20101227_win32.zip in C:\GTK;
Unpack the downloaded file in C:\GTK;
Go to the System environment and add to system variables C:\GTK\bin to your PATH;
Restart Windows;
Run the following code:
url <- "https://cran.r-project.org/src/contrib/Archive/gWidgetsRGtk2/gWidgetsRGtk2_0.0-86.1.tar.gz"
pkgFile <- "gWidgetsRGtk2_0.0-86.1.tar.gz"
download.file(url = url, destfile = pkgFile)
install.packages(pkgs=pkgFile, type="source", repos=NULL);
Finally, run install.packages("RQDA",repos="http://R-Forge.R-project.org", type="source");
Enjoy!!!
FWIW, I've written a package called RQDAassist that I and my team use to help with RQDA, including installing the CRAN archive on R 4.0. Check it out and if there's any problem, do post an issue. To do the step-wise installation of RQDA
RQDAassist::install()
That's it.
Also, I noticed that active development is ongoing by RQDA maintainers, so I expect (hope) this issue to be resolved soon.

R: install uroot package in ubuntu

I am trying to install the forecast package which depends on uroot, which apparently have been written to require a GPU?
install.packages("uroot") yields the following error. Has anyone found this issue and may suggest a work around? I am using ubuntu 16.04.
I have the file in question located here: /usr/local/cuda-8.0/ and I added to my path export PATH=/usr/local/cuda-8.0/:$PATH
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot/libs/uroot.so':
libcudart.so.8.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot’
Warning in install.packages :
installation of package ‘uroot’ had non-zero exit status
Just in case this is useful for someone, I stumbled with the same problem trying to install "imputeTS" with R version 3.5.1 on Fedora 27 with CUDA 10.0 correctly installed an setted in PATH.
for me it just happened that I was running install.package("imputeTS") (which depends on forecast) in a R console as root, installing the packages to the user home solved the problem. It's seems that the libraries are searched in different places according to the user running the script, it's important to note that.
I just migrated to Linux. On an Ubuntu 18.04 setup, using install.packages with dependencies set to TRUE succeeded with no complaints. (No GPU on mu box.)
install.packages("forecast", dep=TRUE)
# there are quite a few dependencies and you happened to be missing one
packageDescription()
#-----------includes this line----------
Imports: colorspace, fracdiff, ggplot2 (>= 2.2.1), graphics, lmtest,
magrittr, nnet, parallel, Rcpp (>= 0.11.0), stats,
timeDate, tseries, urca, uroot, zoo
You can try to modify file "/etc/rstudio/rserver.conf", add "LD_LIBRARY_PATH" env, like:
rsession-ld-library-path=/usr/local/cuda/lib64
Actually, When you open session of "RStudio Server" from browser, the session does't get env from the ".bashrc".

R 3.2.3 devtools::install_version() fails (.zip file not found)

I'm trying to leave instructions for how to set up an R environment as similar as possible to mine on Windows. I found this stackoverflow thread, which was really helpful:
Installing older version of R package
I can get most packages to work using the "versions" package, which pulls from MRAN. However, a few packages are not available on MRAN (because they were published too long ago).
So I tried to use the devtools::install_version() option. However, I have found that I get the following error:
devtools::install_version("proj4", version = "1.0-8")
#> trying URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip'
#> Error in download.file(url, destfile, method, mode = "wb", ...) :
#> cannot open URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip'
#> In addition: Warning message:
#> In download.file(url, destfile, method, mode = "wb", ...) :
#> cannot open URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip': HTTP status was '404 Not Found'
#> Warning in download.packages(pkgs, destdir = tmpd, available = available, :
#> download of package ‘animation’ failed
By navigating around the website, I think that the CRAN no longer posts .zip files, but there is a .tar.gz file:
https://cran.rstudio.com/src/contrib/proj4_1.0-8.tar.gz
I believe that I still could install a .tar.gz file, but I don't know how to make R do it for me.
I'm hoping that someone here can help me with a solution that gets devtools::install_version() to work on R 3.2.3. (If the only solution is to install version 3.2.4, then I could probably make that work, too, but would prefer not to)
I'd also appreciate some pointers explaining how these packages are stored. In particular, it seems possible that I could just copy the folders out of my library and have someone else put them into theirs, and things will work (as long as they are also using windows(?)). Or would I have to build binaries? If so, how would I do that? This way I could have the devtools::install_version() method only as a backup.
Thanks!
When you install a package, devtools get the type from
getOption("pkgType")
To install the source version, i.e. the tar.gz file, just specify the argument
devtools::install_version("proj4", version = "1.0-8", type="source")
I'm presuming you're using Windows, so you may have to install Rtools as well.

ggplot2 version 1.0.1 won't load into R 3.2.2 for Windows

I just started using R and downloaded ggplot2
install.packages("ggplot2")
I get the following warning:
Warning in install.packages:
unable to move temporary installation '\\CHI-FIlE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\file27ac2d3b613c\ggplot' to '\\CHI-FILE-01\UserFolders$\naresh.kavuri\Documents\R\win-library\3.2\ggplot2'
This warning is followed up with this error:
Error: invalid version specification 'NA'
In addition: warning message:
In utils:::packageDescription(packageName, fields = "Version") :
no package 'knitr' was found
As anyone come across this problem before? Did I do something wrong in the setup?
If you have multiple versions of R running, and you try to update or reinstall a package in one version of R while it is loaded in another, then the old version of the package doesn't get completely removed.
Try closing down all instances of R, manually deleting the folder containing the package, then opening a single version of R and reinstalling.
As Pascal commented, antivirus file scans can also interfere with the installation process. Sometimes downloading the package zip/tar.gz file then installing from disk can circumvent the issue.

Resources