I am trying to manually load a package in R using a binary file, as I am in a virtual environment without internet connection.
The install seems to be going fine, but when I try to load the library into an RStudio session, I get the following error:
Error: package or namespace load failed for 'cli' in inDL(x,
as.logical(local), as.logical(now),...): unable to load share object
'C:/Users//cli.dll' : LoadLibrary failure: The specified
procedure could not be found.
This process has worked several times for other packages, but cli seems to be the only one that I've had this issue with thus far. I believe all dependencies have been installed with their most recent versions. Anyone come across this before?
Whenever you come across issues with .dll files there are a couple of possible solutions:
Ensure that your security/firewall policies have not quarantined the .dll file as this is quite common, especially on work machines.
Delete the package folder in your .libPaths()[1] directory and re-install the package from a vanilla R session (i.e. R --vanilla)
Lastly, ensure your machine has latest version of rtools installed and it is on your PATH environment variable (includes the necessary compilers for C++ like make, etc. You can test this by running Sys.which("make") which should point to your rtools path usr/bin/make.exe
Related
Earlier today I was trying to install a package from github using the library_github command from the devtools package. However, I received an error that devtools could not be used because rtools was not installed. I tried to install rtools using the notation described directly by https://cran.r-project.org/ to install rtools for Windows 10 device. However, this never worked. I went down a rabbit hole of trying to google how to setup rtools with R that led me to uninstall, redownload R, R-Studio, and R-Tools several times. I don't remember all that I tried, but I do remember the 2 main things which I will list below.
1.
The computer I am using is a Windows PC that is less than 4 months old, so much of my work up to this point has been automatically saved by Microsoft on their free Onedrive trial. I never paid much mind to it and didn't even realize all of my work and Internet downloads including my original setup of R and R-Studio had been saved on
OneDrive. This hadn't been an issue until recently when my free trial space on Microsoft OneDrive ran out. As a part of this process I went and tried to move everything off of OneDrive onto my computer's hard drive. A part of this included routing my packages that I would install in R onto a folder on my hard drive as is illustrated in this link: https://medium.com/#ValidScience/how-to-fix-rstudios-package-installation-on-windows-10-c1e602bf3a1f. So while I don't think that my current installation of R is tied at all to OneDrive, I have linked my installations in R to another folder on my hard drive called RFolder.
2.
When initially trying to install Rtools onto R I copied pretty much everything that this user illustrated in this video: https://www.youtube.com/watch?v=njZBf34Akgo After I completed the steps in this video, I first began to see issues with R-Studio being unable to access the stats file in R. I also began to get this error code every time that I opened R:
During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
[Workspace loaded from ~/.RData]
When I googled this issue of LoadLibrary failure I was led to this thread https://community.rstudio.com/t/stat-package-will-not-load-after-installing-rtools/63265/11 where a user specifies a solution about deleting a hidden "./Renviron" file. I don't understand this at all and can't seem to find this file anywhere on my computer.
I have tried the simple solution of just deleting R, R-Studio, and RTools from the computer several times. However, even when I only redownload R and R-Studio and try to and try to get them to work, I am met with this same error. As it stands, I can no longer do anything in R because I cannot load any packages. I am able to install packages, but every time I try to use them with the library command I get this error:
Error: package or namespace load failed for ‘tidyverse’ in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Program Files/R/R-4.1.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
Any ideas on how to fix these issues would be greatly appreciated.
Due to my company's firewall I am manually installing packages from local. No errors when building the package from terminal, but I get an error when I load the package using library function
unable to load shared object 'C:/Program Files/R/R-3.6.1/library/Rcpp/libs/x64/Rcpp.dll':
LoadLibrary failure: The specified procedure could not be found.
And it also throws a prompt
Any help is appreciated thanks!
Tried:
Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object
https://github.com/r-lib/rlang/issues/306
None of the above seemed to work
I had this issue. I was using R 4.0.0 in RStudio (1.2.5042). I had been using R just fine all morning and continually had this issue all afternoon. I restarted my computer, updated my packages, and confirmed everything worked well on another computer. Finally I updated to R 4.0.2 and my issue resolved.
My binary package was correctly pathed to 4.0/Rcpp. I still don't know what caused the issue, but since this seemed to fix it hope it will for any future folk with this issue!
There has been a significant change in the build tools used for binary R packages on Windows:
Starting with R 4.0.0 (released April 2020), R for Windows uses a brand new toolchain bundle called rtools40.
https://cran.r-project.org/bin/windows/Rtools/
This means one has to be extra careful to get the correct file when downloading binary packages from CRAN, since packages for build with incompatible build tools will not work. At the time of writing this means:
Use the ones for r-oldrel for R 3.6
Use the ones for r-release for R 4.0
When this question was asked, R 4.0 was still r-devel.
You do not have to think about this things when using the build in install.packages() instead of manually downloading files from CRAN.
I am currently trying to install packages on R. On the startup, I get the normal R message with
"Error: object 'getw' not found"
When I use the install.packages function, I get the same error at the end of the installation, one for each package I tried to install.
However, when I start R with R --no-init-file I can install packages normally.
I have been fishing around with Rprofile and other initialization settings of R. I have also done clean installs of R, and the message still appears.
Does anyone have an idea about how to remove this error? Also, this machine is running Ubuntu 14.04 Trust Tahr.
This sounds like something is wrong with the .Rprofile file. There can be more than one such file. At the beginning of an R session, R first searches for such a file in the working directory, then in the home directory.
You may also want to check if the environment variable R_PROFILE_USER is set (In an R shell, this can be checked with Sys.getenv("R_PROFILE_USER")). If yes, look at the .Rprofile file in that directory to see if there is any suspicious entry.
If all fails, make a copy of the .Rprofile file in your home directory and (if applicable) in your working directory with a different name. Then delete the file and try the installation again. If this succeeds you can afterwards restore the old .Rprofile file(s) by using the copy/copies that you made before.
I had the same error. In my case, this was due to a previous partially failed uninstall of the package I was trying to install. Manually removing the partially uninstalled version of the package then allowed intall.packages to succeed.
Full details:
I had run devtools::install_github(...) which prompted about newer versions of some required packages being available. I opted to install these updated versions in response to the prompt. One of these packages (Rcpp) failed to be installed with an error about being unable to remove the older version of that package (presumably due to the file being in use/locked somehow).
When I tried to install a newer version of Rcpp from install.packages, I got the above error.
After investigating various things, I eventually ran .libPaths() which output the location my packages are installed. I went to this folder, found the Rcpp subfolder, which was mostly empty except one file (Rcpp.dll) - presumably the file that failed to be deleted before. I deleted this file manually and deleted the Rcpp folder.
I then retried install.packages(...) which now succeeded.
I´m developing an R package in RStudio and a set a local library to contain all my packages. After installing some updates in my Ubuntu system, it seems that my R Project have lost track of the local library and is unable to load the libraries that were associated with it. If I try to Build & Reload the package with
R CMD INSTALL --no-multiarch --with-keep.source mypackage
The program tries to install to library '/usr/local/lib/R/site-library/' which is rejected with:
ERROR: No permission to install to directory '/usr/local/lib/R/site-library/'
As far as I remember, whenever I rebuilt my package, that line pointed to my local directory, where all my libraries were localted
installing to library ‘/home/user/R/x86_64-pc-linux-gnu-library/3.2’
It is clear that somehow R have lost track of the connection between the project and the libraries.
I tried re-including the path with
.LibPaths("/home/user/R/x86_64-pc-linux-gnu-library/3.2")
but, just after I rebuild the package again, the program created a 3.3 directory in x86_64-pc-linux-gnu-library. From there, it is unable to find the libraries that are associated to my program and throws another error:
ERROR: dependencies '...', '...' are not available for package "mypackage"
Is there a way to restore the program to the way it was before so I don't have to reinstall everything and start from scratch?
By default, R adds the major-minor version numbers to the library path (?.libPaths) for a good reason, assuming that the jump from 3.2 to 3.3 introduced efficiencies or incompatibilities. It is implied that this version jump requires new installation of packages.
If you override this, packages assembled in 3.2 may not always play nicely in 3.3. (I'm not going to test this theory, please report back if you can disprove this statement, I'm honestly interested!)
BTW: your call to .libPaths seems suspect: I don't know of a capital-L version, and when calling it you should include the previous path (unless you truly mean to omit the system R library paths entirely), such as:
.libPaths("/home/user/R/x86_64-pc-linux-gnu-library/3.2", .libPaths())
If you choose to do that, any bugs you may find in others' packages are possibly due to that incompatibility and should not necessarily be reported to developers.
Another option would be to re-install all packages from your 3.2 installation into your 3.3 library path. Something like this should help automate the process:
# to reinstall packages installed in R-3.2 subdir into R-3.3
install.packages(list.files(path = "~/R/x86_64-pc-linux-gnu-library/3.2"))
I am developing a package using Rcpp and another third party C++ library. When I tried to install the package, I got
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Users/Admin/Documents/R/win-library/2.15/packagename/libs/i386/package.dll':
LoadLibrary failure: The specified module could not be found.
In 32-bit Windows OS, following an advice from my colleague, I fixed the problem by adding location of following dlls from MingW to system path.
libgcc_s_dw2-1.dll
But 64-bit Windows, I get the same error even with the dll although I am using 32-bit R.
So my question:
Is there any way to know why The specified module could not be found error occurs? I mean I would like to know which module is missing. Maybe verbose option some where?
There is not an easy way in R to get more information from the error I mentioned. But I found free software to find which dependency the dill is missing by following web site: http://www.dependencywalker.com/
Using the software I was able to find following dlls are needed to be in system path.
GPSVC.dll
IESHIMS.dll
SYSNIFY.dll
As hinted by the post Win 7, 64 bit, dll problems, the output of dependencywalker may be misleading. In my case, the path to "Microsoft SQL Server" was missing in my system %PATH% environment variable (deliberately removed, because it seemed unnecessary). After that the LoadLibrary error vanished and the library loaded.
I belive you can Run you R software as Administrator you can solve your problem...
You may check: Unable to load any package in R (unable to load shared object)
I ran into this same problem and the issue turned out to be that Windows was not looking in the right place for jvm.dll. Solution was to add location of this dll to Windows PATH variable.
Found solution here: Using the rJava package on Win7 64 bit with R
Instructions on how to edit PATH variable here: https://www.java.com/en/download/help/path.xml
I was also facing the error
"Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status".
I followed the following steps
restart the RStudio,
install.packages("tidyverse")
removed the folder C:/Users/CHILIKA/Documents/R/win-library/3.5/00LOCK-rlang
and again
install.packages("rlang")
then rlang sucessfully installed.