For me to install a package A in R I need another 64 packages (these packages depend on each other). I downloaded all the packages in a folder, including package A (I did this on a computer with internet access). I tried the following:
library(tools)
write_PACKAGES("/home/user/Documents/packages to install/")
after,
install.packages ("StarBioTrek", contriburl = "file: /// home / user / Documents / packages to install /", verbose = "progress report")
but the following message appeared to me:
Error in install.packages: error reading from connection
How can I install Package A on another computer (without internet access)?
Thanks in advance
Related
I have a window ubuntu VM. I have R installed in the windows. I recently tried to call an R script in my ubuntu but it told me the library is not installed. Is there a way to tell ubuntu's R installation to use my windows R libraries so I don't have to reinstall them all on ubuntu?
StratifiedFullModel/SecondRun$ Rscript StratifiedFullModels.R
Loading required package: car
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(x, dependencies = TRUE) :
'lib = "/usr/local/lib/R/site-library"' is not writable
Error in install.packages(x, dependencies = TRUE) :
unable to install packages
Calls: lapply -> FUN -> install.packages
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘car’
Execution halted
This is strange because the script is set up to check for packages, one of which is car, and either load them or install them. I suspect it is not doing so because of some problem with permissions.
This is problematic because I may want to write scripts that just auto install packages without me having to manually do it which would be time consuming if I share a script with a colleague or if I transfer work to a new machine.
Edit: Tried turing R on in ubuntu and running install.packages("car") returned the following error:
> install.packages("car")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("car") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel) cancel
Error in install.packages("car") : unable to install packages
>
I just cancelled the install. I think this confirms my suspicion that there is an issue with the permissions.
The Linux and Windows installations of R are completely separate, and that includes packages. That said, you can run the Windows version from within WSL, so you don't need to maintain duplicate environments.
Here's a screenshot of both Linux and Windows R running on my machine, from within WSL:
Note that this answer is based on my experience with WSL rather than R specifically. I'd welcome updates or more authoritative answers from anyone who has used R under WSL.
I believe you are going to run into problems if you attempt to use, at least, some Windows R libraries from WSL. A 'pure-R' library should work, in theory, but it looks to me from some quick searches that R can also include compiled code which would be platform-specific. In this case, if any libraries end up in native-code, then a Windows library is going to have issues when called from Linux with Linux path structures (e.g. /home instead of C:\Users), processes, and other OS constructs.
As for the permissions issue, R is using a default library directory (under /usr/local/lib/R/site-library) that is only writable by root. It appears that you can change the library installation directory with something like:
> install.packages("car", lib="/home/<username>/.local/lib/R/site-library/")
Of course, you'll need to create that directory first. See this page for more details.
I am new to RStudio. And it was working well, about a week ago my computer update the new version of the system. And from this moment R doesnt work like before. I am trying to load at datasets in .xlsx and .cvs - it doesn`t work. R write like this:
** Installing R Package Dependencies for Excel Import: `'readxl', 'Rcpp'`
[1/5] Installing cellranger...
�������������� � utils::install.packages("cellranger", repos = "https://cran.rstudio.com/") :
'lib = "C:/Program Files/R/R-4.0.2/library"' is not writable
������ � utils::install.packages("cellranger", repos = "https://cran.rstudio.com/") :
unable to install packages
������: sourceWithProgress -> eval -> eval -> <Anonymous>
���������� �����������
I trying to install xlsx packages, it writes like this:
`install.packages("xlsx")`
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Warning in install.packages :
'lib = "C:/Program Files/R/R-4.0.2/library"' is not writable
Warning in install.packages :
не могу создать каталог 'C:\Users\Lina\OneDrive\?????????' по причине 'Invalid argument'
Error in install.packages : unable to create ‘C:/Users/Lina/OneDrive/?????????/R/win-library/4.0’
if somebody can help me?
Since you appear to be a Windows user, I can offer two pieces of advice.
First, make sure your R installation is in a location that you have write permissions to. In some Windows OS, the Program Files locations are by default locked down. If the computer is yours, you should be able to change the permissions to the R folder. How to do so will vary a little by your windows version, so I will not provide more instructions. One other thing you can try is to set R and RStudio to "Run as administrator".
Second, OneDrive is a bad place to put your R installation or your R packages. OneDrive does not support all filenames and file extensions. R and its packages will generate a number of unsupported files, and you will continually be notified that something will not sync and that you should do something about it.
On a Windows machine, I generally install R and set up the library at C:\R where I have appropriate permissions.
I'm not able to install any packages in R. I tried in all versions of R starting from 3.2.2 till 3.2.4(revised), but I get the same error. It seems like a proxy issue to me as I'm connected to my college firewall. I was able to install the packages when I'm connected to my home network. Can you please guide me to resolve this issue.?
Here are the error messages
> chooseCRANmirror()
Error in download.file(url, destfile = f, quiet = TRUE) :
cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: 'The server name or address could not be resolved'
> install.packages("ggplot2")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository https://cran.rstudio.com/src/contrib
Warning: unable to access index for repository
Warning: unable to access index for repository
Warning: unable to access index for repository
Warning message:
package ‘ggplot2’ is not available (for R version 3.2.2)
This is the same problem I was also facing while installing any packages. The main reason what I think is that your R session can't connect to the files path on Cran server.
What I did was just manually go to the Cran website and download the windows release for that particular package. Now unzip the files and manually paste the folder into your library folder of R.
The library folder path will be something like this:
C:\Program Files\R\R-3.2.3\library
Now go to your R console and load it with library(package name).
You can now use your package.
Simply use HTTP mirror instead of HTTPS ones.
To change mirror go to "Packages menu" -> "Set CRAN mirror" -> "(HTTP mirrors)" -> select any
Thanks for your valuable feedback guys. The solution to this problem drove me crazy. I have set my proxy settings according to my college network in MOZILLA, however, I have not set the same for IE. I guess, R downloads the packages based on IE settings, which was not configured. After setting the proxy to connect to the internet, I was able to download the packages without any issues.
Figured this out after trying all your solutions, but at last it was this silly thing that worked.
Thanks for all your time and suggestions.
you can reset and restore your internet connection (for windows and your default explorer),The problem will be solved.
To fix:
Uncheck the 'use secure download method' checkbox in Rstudio global options.
Restart internet then restart Rstudio
utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository https://ftp.iitm.ac.in/cran/src/contrib:
cannot open URL 'https://ftp.iitm.ac.in/cran/src/contrib/PACKAGES'
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
no packages were specified
I want to install http://cran.r-project.org/src/contrib/Archive/mecdf/ using RStudio but when I use
> install.packages('C:\\Users\\jandre\\Desktop\\mecdf_0.6.1.tar.gz', repos=NULL, type="source")
I get this error:
Installing package into ‘C:/Users/jandre/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Warning in install.packages :
running command '"C:/Program Files/R/R-3.1.1/bin/x64/R" CMD INSTALL -l "C:\Users\jandre\Documents\R\win-library\3.1" "C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/jandre/Desktop/mecdf_0.6.1.tar.gz’ had non-zero exit status
This occurs in every package I want to install using the tar.gz file. I'm on Win7 x64. RStudio Version 0.98.1028
Can't think of a way to fix this at the moment -- sorry -- but the R administration manual says explicitly:
Note that installing R into a directory whose path contains spaces is not supported, and at least some aspects (such as installing source packages) will not work.
I don't know why this doesn't bite people much more often, given that C:/Program Files/... seems like a relatively normal place to install things on Windows.
I would also expect that the double quotation marks around your R executable name ("C:/Program Files/R/R-3.1.1/bin/x64/R") in the system call should have protected you from this problem ... ?
I had the same error message with the installation of some packages(under Windows 10 OS with R and Rstudio).
It seems that the R software (not R Studio) is dealing with the library where package are installed.
I uninstalled R and Rstudio and installed it a path without space (ex: C:\Program\R).I tried to load the packages that previously failed and it seemed to fix the problem.
I am somewhat new to R, and I thought I understood how to install packages from CRAN mirrors and from source files, but now I am stumped. I currently am using R 2.10.0 on a Windows 7 32-bit machine.
I want to try to use the RGoogleAnalytics package found here and am trying to follow the instructions. They instruct us to install both RCurl and the XML packages from omegahat. For example,
install.packages("RCurl", repos = "http://www.omegahat.org/R")
however this does not work, as I get the following error:
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘RCurl’ is not available
When I try this instead:
install.packages("RCurl", repos = "http://www.omegahat.org/R", type="source")
I get the following error after the file downloads. I previously had version 1.0 and that is restored.
trying URL 'http://www.omegahat.org/R/src/contrib/RCurl_1.5-0.tar.gz'
Content type 'application/x-gzip' length 735041 bytes (717 Kb)
opened URL
downloaded 717 Kb
* installing *source* package 'RCurl' ...
Warning in system("sh ./configure.win") : sh not found
ERROR: configuration failed for package 'RCurl'
* removing 'C:/PROGRA~1/R/R-210~1.0/library/RCurl'
* restoring previous 'C:/PROGRA~1/R/R-210~1.0/library/RCurl'
The downloaded packages are in
‘C:\Users\Brock\AppData\Local\Temp\Rtmpc9wt5N\downloaded_packages’
Warning message:
In install.packages("RCurl", repos = "http://www.omegahat.org/R", :
installation of package 'RCurl' had non-zero exit status
Without going into details, I haven't been able to use the RGoogleAnalytics package as I get the same error that is found in this post. I simply am trying to exhaust every possible option to get around the error.
Any help or insight you can provide will be greatly appreciated!
The RCurl project page on CRAN says the Windows binary is not available. The ReadMe points you to a page maintained by Professor Ripley, where he provides binaries of RCurl and several other packages that have special build needs on Windows. However, he only provides them for the most recent major revision of R, so you would need to upgrade to R-2.12.0 to install them from his page.
If you want to build packages from source on Windows, you need to install Rtools first. It looks like you haven't done that. Even if you had them installed, it will still require extra steps to build RCurl on Windows... else the Windows binary would already be on CRAN.
Your best bet is probably to upgrade R and install RCurl from Prof. Ripley's page.
You are probably missing the components to build packages under Windows:
http://www.murdoch-sutherland.com/Rtools/
According to RCurl FAQ, either
curl-config is not found in your path
or
curl-config and related devlopment libraries (libcurl) are not installed.