Trying to compile version 3.98-1.10 of R's XML package. I grabbed the 64bit 7zip files from here: https://www.zlatkovic.com/pub/libxml/64bit/
I unzipped the file, and then placed the contents of the unzipped folder's \bin, \include, and \lib into C:\rtools40\mingw64\(bin | include | lib) accordingly. I then ran install_version("XML", version = "3.98-1.10", repos = "http://cran.us.r-project.org") in Rstudio.
It successfully makes it past the make phase to "byte-compile and lazy loading". A LOCK folder is made with all files intact, yet it errors out looking for the XML.dll in the lock:
error: unable to load shared object 'C:/Users/myuser/Documents/R/win-library/4.0/00LOCK-XML/00new/XML/libs/x64/XML.dll'
I opened the LOCK folder during a second attempt to see if the dll was truly missing, but it actually shows up - it seems to spontaneously disappear when it's needed (edit - the contents of the entire folder disappear):
My current version of XML isn't missing its dll either. Anyone encounter this issue and solve it?
Pastebin of terminal output (minus make stage) here: https://pastebin.com/ZayU5XNX
EDIT:
Found out RStudio can conveniently install tar.gz files, so I downloaded the archived version from CRAN. Running install.packages(file.choose(), repos=NULL) opens a navigation panel and you can select the tar.gz file wherever it was saved to. The make dialogue seems to be more verbose, but it still made it to the lazy-load step. Still the exact same error as my previous attempt.
I solved this by just using xml2 instead since it appears XML is orphaned.
I know that by title, this question duplicates with a previous, but there was no satisfactory resolution provided.
I am installing R 4.0.0 on a MacOS Mojave. I don't have admin access, and I am not able to obtain it for the foreseeable future.
I have downloaded and extracted the .pkg file into a folder. The folder layout is as follows:
If I use terminal to run the following commands:
export RSTUDIO_WHICH_R=~/Documents/RStudio/r_4.0.0/R.framework/Resources/bin/R
open ~/Documents/RStudio/RStudio.app
I get the error:
Unable to find libR.dylib in expected locations within R Home directory /Library/Frameworks/R.framework/Resources;
Unable to find libR.dylib in expected locations within R Home directory /Library/Frameworks/R.framework/Resources
I have tried:
export R_HOME=~/Documents/RStudio/r_4.0.0/R.framework/Resources
export R_HOME_DIR=~/Documents/RStudio/r_4.0.0/R.framework/Resources
I have also tried going into the ~/Documents/RStudio/r_4.0.0/R.framework/Resources/bin/R file
and manually replacing the file paths with mine. But I still get an error:
dyld: Library not loaded: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libR.dylib
Referenced from: [My User directory]/Documents/RStudio/r_4.0.0/R.framework/Resources/bin/R
Reason: image not found
Abort trap: 6
At this point I am at a loss of what I am able to do (anything?) it seems /Library/Frameworks/... is hardcoded at some point and I can't do anything about it. Can anyone suggest a fix.
I've faced this error when I'm trying to open rstudio without installing R.
I solved it by first installing R from https://cran.r-project.org/bin/macosx/ and try to re-open the rstudio again.
This will resolve this error on macOS.
I'm working in RStudio and am attempting to install the dplyr package. I have installed various other packages without problem but have hit a problem with this.
It seems there are various parts to the install, some of these worked but the problem happens when I get 'the dependency BH'. This is the error:
>Installing package into ‘\\xxxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘BH’
>trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/BH_1.62.0-1.zip'
Content type 'application/zip' length 16150075 bytes (15.4 MB)
downloaded 15.4 MB
>trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/dplyr_0.5.0.zip'
Content type 'application/zip' length 2556205 bytes (2.4 MB)
downloaded 2.4 MB
>Error in install.packages : cannot open file '\\xxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3/file142032c9327b/BH/include/boost/function/detail/gen_maybe_include.pl': Permission denied
I have changed the directory/libpath as it did not appear that the file was downloading to the correct folder. file142032c9327b is now in the correct path, but path specified in the error is only correct up to /boost, there is no function folder here..?
I'm not sure if this missing folder is the issue, as the error says 'Permission denied', but it seems odd.
I had the same issue. Tried doing the following and worked for me:
Run the RStudio as administrator
Under the Packages tab, click Install and change Install to Library option to C:/Program...../R/../library and select the desired package to install.
Hope it works.
I had the same problem. R gave me an error message whenever I tried to install a new, or update an existing package. I don't remember what the message said exactly, but it was saying "Cannot open file (...) access denied". I tried all the following. Not sure what exactly fixed the problem, but now I can update and/or install new packages:
Open R/RStudio as administrator;
Change the R library folder (where packages are installed) security settings, and grant full access to my computer user account. Link1, link2;
(I think this was what fixed the problem) Follow instructions on this link. It prompted me to install another package, "devtools". Then it worked.
Well, I think my problem was a special case, but it might benefit someone. I had the Windows Defender Ransomware Protection set to ON. That was blocking rsession.exe by default. Allowing rsession.exe solved the problem.
TL;DR
The "Documents" (or "My Documents") directory is a special location in Windows. I don't know if the system itself processes its permissions differently or if antiviruses target operations inside this directory more strictly, but many R users have issues installing packages in the personal library inside this folder (even if running R as administrator). Other answers haven't worked.
For me, what solved the problem was to put the personal library directly under X:\\Users\username\ instead of under Documents, which is the R default on Windows. To make it permanent, I set a user environment variable R_USER to %USERPROFILE%. Here is a nice guide of how to set environment variables in Windows.
Note: after this change, you may need to move your .Rprofile, .Renviron, etc. files from Documents to the user profile directory.
Details
The default location for R's user "home" directory on Windows is X:\\Users\username\Documents. This is because there is no concept of HOME in Windows, just of a "personal" directory (Documents): https://cran.r-project.org/bin/windows/base/rw-FAQ.html#What-are-HOME-and-working-directories_003f
Therefore, by default, the personal library location is under X:\\Users\username\Documents\R\win-library\X.Y\. You can get the exact location on your machine with this command in the R console:
Sys.getenv('R_LIBS_USER')
I was getting this same cannot open file error when trying to install or update packages, even when running as administrator. I suspected of directory permissions, checked it within the directories' "properties" without luck. Removed the whole R\win-library tree and recreated it and nothing... Finally, I tried to move the personal library location to my users' directory:
.libPaths('X://Users/username/R/win-library/X.Y/')
And it worked!
Warning in install.packages :
cannot create file '/usr/local/Cellar/r/3.6.2/lib/R/doc/html/packages.html', reason 'Permission denied'
Warning in install.packages :
cannot update HTML package index
I had the same permission issue when trying to download a pkg--ISLR. Fixed it after following the above answers.
In case, some are new to R studio like me. These were my steps to install a pkg.
Click Terminal next to Console in R studio
Type sudo r, to run r as an administrator
install.packages("ISLR") to install your package
--- Please select a CRAN mirror for use in this session ---
https://cran.rstudio.com/src/contrib/ISLR_1.2.tar.gz
Secure CRAN mirrors
1: 0-Cloud [https] 2: Australia (Canberra) [https]
3: Australia (Melbourne 1) [https] 4: Australia (Melbourne 2) [https]
Pick a number -- a mirror site, then click enter.
Voilà! Package installed.
I had faced also this issue. The one and only solution that helped me was to turn off my firewall. Then I was able to download all packages.
The problem solved for me after running R in admin mode and disabling Antivirus.
Translating #Shubham Yadav's answer to code mode would be something like this: install.packages("your_package", lib = "C:/Program Files/R/R-4.0.3/library")
It's working for me (running RStudio as admin, course).
This procedure worked for me.
Removed existing package with remove.packages()
ran RStudio as an admin
Installed by specifying the libpath: devtools::install_github('https://github.com/Rdatatable/data.table/tree/frollmax', lib=.libPaths()[2])
For me what worked was manually deleting within the library directory the folder that I had problem with updating. And then install.package() again.
I had faced the same issue.
I tried below steps to resolve this issue:
Launch RGui application.
Go to Packages section and select Install Packages.
Select the Package that you want to install from the Packages pop up window.
And click OK, that's it package will get successfully installed.
After following above steps, you can run use your package from RStudio.
I ran into this issue today where rlang couldn't install the newest version and so tidyverse wouldn't work. I tried running as admin, changing install location, running as admin, permitting rstudio through Windows Defender Randsomware Protection, and installing DevTools. The only thing that worked was to uninstall RStudio, reboot, reinstall.
I have a computer behind a very restrictive proxy server it only allows me to surf the web and download programs it does not allow programs like the Atom text editor to download it's packages.
My question is how do I install them using only browser based downloads?
It is certainly possible:
Find the package you want to install, for example the activate-power-mode package.
Click on the Repo button to go to the GitHub repository.
Click Releases towards the top of the UI, then click on the most recent release, 0.4.1 in this case.
Download the source code release in either Zip or GZip depending on your platform.
Extract the content of the archive to a known permanent location, I have chosen:
C:\Source\Atom
Run the following command from your terminal / command prompt (make sure to include quotes around the path):
apm link "C:\Source\Atom\activate-power-mode-0.4.1"
Restart or Reload Ctrl-Alt-R Atom and the package will now be installed.
You can alternatively extract the package directly to your ~/.atom/packages folder however you will have to rename the folder to exactly match the name of the package, additionally uninstalling the package from Atom will delete the files which could be annoying if it is an accidental deletion.
Because of package dependencies a safest bet is this:
Install package normally on connected computer
Copy contents from your ~/.atom/packages
Paste contents to ~/.atom/packages on offline computer
Restart Atom
At least this worked for me like a charm.
The answer of Richard Slater is informative and the answer of Andriy Buday could look less professional. But, in my case, the answer of Andriy Buday was also very important.
I tried to install two packages atom-beautify and prettier-atom by following the answer of Richard Slater and had some problems of not being able to find some modules. It was not only me who had these problems. Consider checking the following links.
The issue of "cannot find module event-kit"
https://github.com/Glavin001/atom-beautify/issues/1734
https://github.com/Glavin001/atom-beautify/issues/1366#issuecomment-269716306
When I decompressed a file (atom-beautify-0.30.3.tar.gz) I received from GitHub respository, I could find out directories like appveyor, docs, and examples. But I could not find out a directory named node_modules which was present when I installed this package atom-beautify using Atom Editor online.
To check if the absence of directory node_modules is the only problem, I went through the following steps.
Start Atom Editor.
Install atom-beautify using Atom Editor online like the answer of Andriy Buday suggests.
Close Atom Editor.
Move atom-beautify directory from ~/.atom/packages (that was %HOMEDIRECTORY%%HOMEPATH%.atom\packages in my case because I used cmd on Windows 10) to somewhere else.
Decompress atom-beautify-0.30.3.tar.gz and move or copy atom-beautify-0.30.3 directory from this decompressed result into %HOMEDIRECTORY%%HOMEPATH%.atom\packages as the answer of Andriy Buday suggests.
Rename directory %HOMEDIRECTORY%%HOMEPATH%.atom\packages\atom-beautify-0.30.3 to %HOMEDIRECTORY%%HOMEPATH%.atom\packages\atom-beautify as the answer of Richard Slater suggests.
Move or copy node_modules directory from the directory moved at step 4 into %HOMEDIRECTORY%%HOMEPATH%.atom\packages\atom-beautify.
Start Atom Editor.
I found that no error message appeared and that package atom-beautify worked properly, thus I am thinking that absence of node_modules directory was the only problem of the file atom-beautify-0.30.3.tar.gz I received from GitHub repository.
I am afraid if it is normal that directory node_modules is not contained in the file atom-beautify-0.30.3.tar.gz downloaded from GitHub repository because of any rules I do not know yet, like placing directories like node_modules somewhere else. If there really are such rules and somebody tells me about such rules by adding an answer or a comment here, I will appreciate it a lot.
I am not sure if it is same with all other packages, but I found that it was same at least with package prettier-atom.
I wish it helps somebody.
+++++++++++++++++++++++++++
I found why the directory node_modules was not contained in atom-beautify-0.30.3.tar.gz.
I checked answers of the following link.
How can I manually download packages for atom editor and install them (manually)?
Answer by D3181 included a link to a page of http://discuss.atom.io/ (I could get a helpful answer by Alchiadus from the link) and suggested running apm install in the package's directory. If it is necessary to use a file downloaded from GitHub repository like atom-beautify-0.30.3.tar.gz, it is necessary to run apm install in the package's directory before copying or moving into %HOMEDIRECTORY%%HOMEPATH%\.atom\package (~/.atom/package in case of *nix) of the offline computer.
Decompress the file downloaded from GitHub repository like atom-beautify-0.30.3.tar.gz.
Go into the directory like atom-beautify-0.30.3 of the decompressed result.
Run apm install on an online computer. (If the directory of apm.cmd is not in PATH, run {directory of apm.cmd}\apm.cmd install.)
Rename directory like atom-beautify-0.30.3 to the correct name of the package like atom-beautify.
Move directory with the correct name of the package like atom-beautify into %HOMEDIRECTORY%%HOMEPATH%\.atom\packages of the offline computer.
Run Atom Editor on the offline computer and check if the package works properly.
It seems normal that the directory node_modules is not included the the compressed file downloaded from GitHub repository.
I just downloaded R3.0.0 in Windows 7, 64 bit.
When I click on the R icon, R launches but with the following error and warning
Error in loadNamespace(name) : there is no package called ‘modeltools’
During startup - Warning message:
unable to restore saved data in .RData
and when I try to start RStudio, it does not launch but says
The R session had a fatal error
Below is a screenshot of the current home page for RStudio support:
A simple reinstall should solve your problem. Do be sure to verify the downloaded file's integrity by checking its MD5 hash. I'm not a Windows user so I can't recommend any particular software in particular to do this. I guess a good starting point would be Microsoft's FCIV (read about it here and here). But, I'm sure there are lots of GUI alternatives too.
At the RStudio download page you'll notice that the correct MD5 hashes are listed, along with the correct file sizes.
As for your error about the .RData file, that sounds like a corrupt .RData file that should be deleted. Most likely, somewhere along the line, you clicked on "yes" when R asked you if you wanted to save the current session (rather than you explicitly deciding to save the session, and thus, giving the file a proper name). Since the file has a dot before it, you'll probably need to enable "show hidden files and folders" to find it.
Also, remember that after reinstalling R, you'll have to also reinstall all of your installed packages before you can use them! After you have R and RStudio back up running, try something like:
update.packages(checkBuilt = TRUE)
to reinstall all of the packages you installed from CRAN. If you've installed packages from GitHub and other places, you would need to reinstall those manually.