Error installing xml2 in R (Unable to load shared object) - r

Let's start with, i am pretty new to both linux (CentOS) and R.
I was given a task to install xml2 package, for that i ran
install.packages("xml2")
and error occured
** R
** inst
** byte-compile and prepare package for lazy loading'
** help
Error : unable to load shared object '/home/<username>/R/x86_64-redaht-linux-gnu-library/3.6/00LOCK-xml2/00new/xml2/libs.so':
libicui18n.so.58: cannot open shared obejct file: No such file or directory
Error: installaing RD objects failed for package 'xml2'
* removing '/home/<username>/R/x86_64-redaht-linux-gnu-library/3.6/xml2'
Then i went ahead and did some research on this issue and found much (maybe to resolve it), but couldn't really understand because of lack of knowledge.
So first thing i did was to search if i even have libicui18n.so.58 by doing locate libicui18n and could find something but not 58.
So I started by downloading ICU 58 source and compiling it manually.
It was successfully done.
Still, there was a same error. Although i could find libicui18n.so.58 by doing locate libicui18n this time.
Now i'm lost because there are so many locations where it shows all the versions of libicui18n.so.58.
Also, when i do $LD_LOCATION_PATH, there's nothing for the output.
Please, if you could, explain it to me what i need to do to resolve it now.
Also, the output of locate command is:
/home/Zach/.local/lib/python3.7/site-packages/PyQt5/Qt5/lib/libicui18n.so.56
/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so
/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so.58
/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so.58.3
/opt/anaconda3/lib/libicui18n.so
/opt/anaconda3/lib/libicui18n.so.58
/opt/anaconda3/lib/libicui18n.so.58.2
/opt/anaconda3/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so
/opt/anaconda3/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so.58
/opt/anaconda3/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so.58.2
/opt/anaconda3/pkgs/icu-58.2-he6710b0_3/lib/libicui18n.so
/opt/anaconda3/pkgs/icu-58.2-he6710b0_3/lib/libicui18n.so.58
/opt/anaconda3/pkgs/icu-58.2-he6710b0_3/lib/libicui18n.so.58.2
/root/opt/lib/libicui18n.so
/root/opt/lib/libicui18n.so.58
/root/opt/lib/libicui18n.so.58.2
/root/opt/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so
/root/opt/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so.58
/root/opt/pkgs/icu-58.2-h9c2bf20_1/lib/libicui18n.so.58.2
/usr/lib/rstudio/lib/libicui18n.so.56
/usr/lib64/libicui18n.so
/usr/lib64/libicui18n.so.50
/usr/lib64/libicui18n.so.50.2
/usr/lib64/webkit2gtk-4.0/libicui18n.so.57
/usr/lib64/webkit2gtk-4.0/libicui18n.so.57.1
/usr/local/lib/libicui18n.so
/usr/local/lib/libicui18n.so.58
/usr/local/lib/libicui18n.so.58.3
/var/lib/docker/overlay2/8aab92bb1b0ffb1addfc835da5c31c169d7af7cc5c825a93f529ab8d4c9cdead/diff/usr/lib/x86_64-linux-gnu/libicui18n.so.66
/var/lib/docker/overlay2/8aab92bb1b0ffb1addfc835da5c31c169d7af7cc5c825a93f529ab8d4c9cdead/diff/usr/lib/x86_64-linux-gnu/libicui18n.so.66.1
/var/lib/docker/overlay2/d445cc4c7c11f7e66bcd0f198287e6b6830b33099fcfe884bc3d0e57d0116c16/diff/usr/lib/x86_64-linux-gnu/libicui18n.so.67
/var/lib/docker/overlay2/d445cc4c7c11f7e66bcd0f198287e6b6830b33099fcfe884bc3d0e57d0116c16/diff/usr/lib/x86_64-linux-gnu/libicui18n.so.67.1
/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.11/02ede84d3591a5ea8028204d86059bffaccb778159ec53c859bbc60d9e7025e8/files/lib/libicui18n.so.57
/var/lib/flatpak/runtime/org.kde.Platform/x86_64/5.11/02ede84d3591a5ea8028204d86059bffaccb778159ec53c859bbc60d9e7025e8/files/lib/libicui18n.so.57.1
/volumes/user/home/Zach/.local/lib/python3.7/site-packages/PyQt5/Qt5/lib/libicui18n.so.56
/volumes/user/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so
/volumes/user/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so.58
/volumes/user/home/Zach/Downloads/test/icu-release-58-3/icu4c/source/lib/libicui18n.so.58.3```

Related

Julia - how to update WinRPM in julia version 0.6.4

I'm new to Julia and I want to use COBRA Package.
For adding COBRA I use command :
Pkg.add("COBRA")
But when running, I get these errors:
INFO: Building WinRPM
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to download
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to download
INFO: Downloading https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
WARNING: Unknown download failure, error code: 2148270086
WARNING: Retry 1/5 downloading: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
until:
WARNING: Unknown download failure, error code: 2148270086
WARNING: Retry 5/5 downloading: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
WARNING: received error 0 while downloading
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
After these errors, I have checked the link and I've found out the source is not there, anymore.
So then I ran this command as said above:
WinRPM.update()
But it has thrown this error:
ERROR: UndefVarError: WinRPM not defined
Please Help me to add COBRA to Julia. I'm using version 0.6.4 because Cobra does not work on the next versions.(Windows 10)
Any help would be appreciated.
The problem, as you've mentioned, is that the original sources used by the package aren't valid URLs anymore. The proper way to solve this is to open a pull request with the package to change the URLs (which I've now done here ). As a stopgap measure, here's a hacky way to work around this issue for now:
Do a Pkg.add("WinRPM"). This might trigger the same warnings as above, ignore these.
Next, using WinRPM to load the package we added
Now, the source URLs are read from the sources.list file (linked above) into a global WinRPM.sources variable. We're going to edit this variable's contents to point to new working URLs. (This is generally a terrible idea, to directly poke into the internals of a module and change things.)
julia> WinRPM.sources[:] = replace.(WinRPM.sources, "Leap_42.3" => "Leap_15.3")
2-element Vector{String}:
"https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_15.3"
"https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_15.3"
A WinRPM.update() should now work, and download things into a local cache.
I'm using version 0.6.4 because Cobra does not work on the next versions.
I hope you mean Julia 1.6.4 here, or version 0.6.4 of something else in the stack. If you mean Julia version 0.6.4, you might face further problems down the road and find it hard to get support for such an old version.

install.packages function does not recognize new library path in RStudio

I am connecting remotely to a work server and need to be able to install R packages via RStudio. I have read through other questions/answers on this topic, but haven't been able to solve this for myself. I think the following input and output shows my issues the best: (edit: I do not have admin powers, but can call IT as last resort)
>.libPaths("C:/RWorkSpace") #setting new file path
>.libpaths() #testing
[1] "C:/RWorkSpace" "C:/Program Files/R/R-3.4.1/library"
>install.packages("bibliometrix", dependencies = TRUE, lib="C:/RWorkSpace")
The downloaded source packages are in
‘C:\Users\cortiz\AppData\Local\Temp\7\RtmpOsVuTB\downloaded_packages’
>library(bibliometrix)
Error in library(bibliometrix) : There is no package called 'bibliometrix'
>installed.packages()["bibliometrix","C:/RWorkSpace"]
Error in installed.packages()["bibliometrix","C:/RWorkSpace"] : subscript out of bounds
I just need to download the package and dependencies, and I expected them to be downloaded to the folder I specified ("C:/RWorkSpace").
very new to working with R in general so please bear with me. Any help greatly appreciated!

Unable to run Papaja in Windows due to spaces in folder name

I'm trying to load papaja in R (version 3.6.0). I'm running Windows 10 on my computer. When I try to run devtools::install_github("crsh/papaja") I get the following error message:
package ‘markdown’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\My
Name\AppData\Local\Temp\RtmpKCmBDG\downloaded_packages
ERROR
cannot change to directory 'C:\Users\My'
The system cannot find the path specified.
Error in (function (command = NULL, args = character(), error_on_status =
TRUE, :
System command error
From some research, including this post and this post, I realise that this is a common issue, but none of the answers I can find help me work around this in papaja.
For info, I don't have this problem when installing other packages using install.packages().
I have managed to solve this problem after hours and hours of googling. The problem is not papaja; it is the presence of spaces in the path, which devtools does not deal with well.
To solve this, I first changed my library path:
.libPaths("C:/Program Files/R/R-3.6.1/library") # for R v.3.6.1
At first I couldn't get this to work - I kept getting the error 'lib = "C:/Program Files/R/R-3.6.1/library"' is not writable. Basically, this is because I did not have permission to write into this folder. To fix this, you simply close RStudio, go to the folder where the programme is saved and right click, then select 'Run as administrator'.

How to input R package from local PC directory

I need to use a package from Hogg's Introduction to Mathematical Statistics text. It is not found on cranR. R input follows below. Package is in 3.5 directory.
library(hmcpkg, lib.loc="C:/Users/mmsta/Documents/R/win-library/3.5")
Error message:
Error in library(hmcpkg, lib.loc = "C:/Users/mmsta/Documents/R/win-library/3.5") : ‘hmcpkg’ is not a valid installed package
How to do without going to Hogg website when I have the directory hmcpkg on my hard drive? This is a generic question; I have encountered this before. I would also like to avoid the complexity of github.
Thanks.
Mary A. Marion

Using RStudio's "Build" but no *.Rcheck generated

I've just started using RStudio's build check, and used it to make one package already. I've started on a second package, and this one is failing. As the build attempt happens, I get updates like:
* checking whether package ‘< package >’ can be installed ... ERROR
Installation failed.
See ‘/home/user/git/< package >.Rcheck/00install.out’ for details.
* DONE
Status: 1 ERROR
The problem is that the defined folder < package >.Rcheck doesn't exist, and neither do the files that are supposed to be in it (i.e. 00install.out, and 00check.log). Also, where I write < package >, the actual name of my package is shown instead.
I had folders view visible while the package was building, and I saw the .Rcheck folder appear, and then disappear shortly after. I was even able to browse the 000install.out file, but it had not yet encountered any errors.
It appears that the whole Rcheck folder is being removed when the build fails, leaving me with no trace of what caused the error.
Has anyone else experienced this? I'm using RStudio version 0.99.902 with R version 3.3.1 on Arch Linux.
My approach is the following one:
Go to 'Tools' -> 'Global Options' -> 'Packages' and then have a look, if 'View Rcheck directory after failed R CMD check' is ticked. You find other useful options there, too, e.g. 'Cleanup output after successful R CMD check'.
A little more detail on how to preserve error logs, based on the answer from #J_F. I needed to tick View Rcheck directory after failed R CMD check, because the cleanup occurs after the misleading message
See
‘.../yourpackage.Rcheck/00check.log’
for details.
I also needed to untick Cleanup output after successful R CMD check, because R CMD can succeed even when there are errors!
R CMD check results
1 error | 3 warnings | 2 notes
Warning messages:
1: `cleanup` is deprecated
2: Version of roxygen2 last used with this package is 6.0.1.9000. You only have version 6.0.1
R CMD check succeeded

Resources