Warning in install.packages: cannot open UR HTTP status was '404 Not Found' - r

When running install.packages in the latest R (3.4) and RStudio 1.0.143 I get the following warning
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.4/PACKAGES.rds': HTTP status was '404 Not Found'
This appears no matter what package(s) I select, however this does not appear to effect package installation. I tried clearing my ~/.rstudio-desktop, /Library/Frameworks/R.framework/Versions/3.4/Resources/library and reinstalling R and this warning still persists. Evening changing CRAN mirrors appears to have no effect as a similar warning appears. Below is my session information.
R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.4
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] datasets stats graphics grDevices utils methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0

Just to let people know: this issue is coming from the R-Studio IDE. It will be fixed in the newest version. For more info: see this link.
EDIT:
With the new version (1.0.153) this issue has been resolved!

As #ManualS already acknowledged this is an issue with the RStudio 1.0.143. As long as there is no fix the following workaround works fine:
Close RStudio and start base R
Install package there, either by
install.packages("packagename") or by menu "Packages/Install package(s)"
Close base R and start RStudio again
A full support session (for the OneR package) with more details can be found here: https://github.com/vonjd/OneR/issues/4

Related

Could not open url 'http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES'

When I install new version of Rstudio (the latest version: 2022.02.3-492),
many packages that were previously installed do not work.
enter image description here
Also, install.packages does not work due to "cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/4.2/PACKAGES'"
First, I checked getOption("repos") and it prints
CRAN
"http://cran.rstudio.com/"
attr(,"RStudio")
[1] TRUE
Next, checked sessionInfo(), and it prints
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Matrix products: default
locale:
[1] LC_COLLATE=Korean_Korea.utf8 LC_CTYPE=Korean_Korea.utf8
[3] LC_MONETARY=Korean_Korea.utf8 LC_NUMERIC=C
[5] LC_TIME=Korean_Korea.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0
Finally, checked my firewall blocker and allowed an application of RStudio R session.
However, none of them works.
It is making me crasy. How can I fix the problem?
In RStudio Go to Tools -> Global Options and in the Packages tab uncheck the box "use secure download method for HTTP".
Packages menu screenshot

R and R studio won't load aplpack

I am using R/Rstudio (version 4.0.3 - "Bunny-Wunnies Freak Out") and have installed the aplpack package. However, when I go to load the package, it just loads forever without actually activating the package. I'm currently running macOS Big Sur 11.2 and I have the latest version of XQuartz installed. To load the package, I am using
library(aplpack)
I saw that someone else has had a similar problem, but they were running a different OS and their question was never answered. I'm hoping someone out there can help.
UPDATE: As was requested in the comments, here is the Sys.info() and the sessionInfo() information:
`Sys.info()
sysname
"Darwin"
release
"20.3.0"
version
"Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64"`
`sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3`
I was able to install and open the aplpack package (macOS Big Sur 11.2) using install.packages("aplpack"); library(aplpack) but it did take some time to load (~2 mins). I suspect your issue is related to xquartz. Xquartz no longer comes installed with macOS, so a likely solution to your problem is to install an up-to-date version of xquartz (https://www.xquartz.org/releases/) and ensure it can be opened from RStudio using x11()
If you want to reach the R - Mac experts,
a posting to the ("good old") R-SIG-Mac (R Special Interest Group # Mac) mailing list will reach them, notably the R Core team members involved:
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

how to fix the error: Error in importIntoEnv(pkgenv, exports, nsenv, exports),cannot add bindings to a locked environment devtools-roxygen2?

After updating Rstudio and macOS, my package is no more loadable with devtools:
devtools::load_all(".")
Loading mgwrsar
Error in importIntoEnv(pkgenv, exports, nsenv, exports) :
cannot add bindings to a locked environment
I update the following packages: devtools, roxygen2 and rstudioapi, but it doesn't resolve this issue
I try to switch to hadley devtools version : install_github("hadley/devtools")
same issue.
My session info :
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4 yaml_2.1.19
You can also get this error from calling library(package) from within the package itself.
Duckmayr's response helped me solve my issue for this same problem:
Do you assign anything to the global environment in your package?
I had saved a new R script in my package project as mypackage/R/myscript.R instead of mypackage/separate_testing_folder/myscript.R. Of course, nothing but actual code pertaining to definition of functions etc should be saved in any scripts within the R/ directory.
In my case, I was accidentally referencing the name of my package INSIDE of my DESCRIPTION. Woops, something like this - I fixed it like so.
Package: utilities
Depends:
dplyr, # and comma here
utilities # remove this

Synchronizing R system settings from Terminal, GUI and RStudio

My problem on my MacOS is that I can use R from GUI (aka console, downloaded from CRAN), Terminal or from RStudio but I cannot have them function in the same way.
Specific example is I can use rJava on Terminal and RStudio but not on GUI. Similar stuff happens for Rmarkdown pdf outputs. I usually get errors from GUI but everything is fine on Terminal or RStudio. How do I update R GUI settings to the same as Terminal's?
ps. For instance R CMD javareconf command handled the Terminal R but not R GUI.
edit: It is not actually something that requires a minimal working example but let's try library(rJava) after installing it.
R Called from Terminal (same with RStudio)
No problems.
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0
R GUI
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0
Some differences between Sys.getenv() are GUI has the following extra
LD_LIBRARY_PATH :#JAVA_LD#
DYLD_LIBRARY_PATH /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/lib/server
Brief update: I was able to correct Rmarkdown situation by using this link and reading help by writing ?Startup on R console. Changed the Renviron file on my R.home()/etc/. But still no rJava.
For R Markdown problem, I managed to handle it by adding a ~/.Renviron file and defining PATH parameter with the value I got from Terminal's Sys.getenv() parameters.
The only thing that worked for rJava for High Sierra is the following answer (changed the version to 3.5 though)
https://stackoverflow.com/a/47685001/3608936

Error installing packages in RStudio: error reading from connection

I have recently updated both R (version 3.4.1) and RStudio (version 1.0.143) and I am now unable to install packages from Rstudio.
If I install a package in R directly using install.packages() it works fine.
If I try and install a package in Rstudio using either install.packages() or using the package install menu I get the error below. I have tried a few different packages, and have uninstalled and reinstalled both R and RStudio.
To get the error:
Run:
install.packages("lme4")
Output:
Installing package into ‘E:/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’
Warning in install.packages :
lzma decoding result 10
Error in install.packages : error reading from connection
I am working off my personal computer, below is some of my system info:
Output from options("repos")
$repos
CRAN CRANextra
"https://cran.stat.auckland.ac.nz/" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
Output from sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252
LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1
This certainly is an issue with your connection:the proxies you are using and repositories configured in your RStudio. I was getting the same error when I was connected to US VPN from India.I disconnected VPN and restarted RStudio and it worked like a charm!
I had the same issue when I tried to install caret.
The best solution is to restart R studio.
Now the install.packages() works fine.
Just restart the R studio it works for me.
I had the same issue after I misspelled a package name when trying to install it. I restarted R Studio and then it worked.
Kindly select appropriate CRAN mirror in R Studio through following option:
Tools>>>Packages>>>CRAN Mirror(Select appropriate CRAN depending on your location).
A simple solution would be to download manually the zip folder of the package and install it with the command :
install.packages('package.zip', lib='destination_directory',repos = NULL)
Package zip : the path to the zip file of the package
Destination_directory: where the packages are installed by default like C:/Users/unknown/Documents/R/win-library/3.3
Hope it helps

Resources