Installing RIO Package : shared object ‘haven.so’ not found - r

I've some problem to install package in R.
I write :
install.packages("rio", dependencies = TRUE)
And it gives the error message:
installing source package ‘rio’ ...
** package ‘rio’ correctement décompressé et sommes MD5 vérifiées
** R
** inst
** preparing package for lazy loading
Warning: S3 methods ‘[.labelled’, ‘[.labelled_spss’, ‘as.data.frame.labelled’, ‘as_factor.data.frame’, ‘as_factor.labelled’, ‘is.na.labelled_spss’, ‘print.labelled’, ‘print.labelled_spss’, ‘type_sum.labelled’, ‘zap_formats.data.frame’, ‘zap_formats.default’, ‘zap_labels.data.frame’, ‘zap_labels.default’, ‘zap_labels.labelled’, ‘zap_labels.labelled_spss’, ‘zap_missing.data.frame’, ‘zap_missing.default’, ‘zap_missing.labelled’, ‘zap_missing.labelled_spss’, ‘zap_widths.data.frame’, ‘zap_widths.default’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) :
shared object ‘haven.so’ not found
ERROR: lazy loading failed for package ‘rio’
removing ‘/home/durand-s/R/x86_64-pc-linux-gnu-library/3.4/rio’
Warning in install.packages :
installation of package ‘/tmp/RtmpZI89tI/downloaded_packages/rio_0.4.6.tar.gz’ had non-zero exit status
I think that I miss some lib-dev or something like that but I cant find which one I need for rio's.

While trying to install the rio package in Microsoft windows. I faced an error. In order to resolve that issue, I googled and came to this page.
I know this post is a bit old but thought to share it for those who face a similar issue in installing this package.
Similar to this post:
Error: "there is no package called ..." and trying to use install.packages to solve it
I could only install rio when I used the command:
install.packages('rio', dependencies = TRUE, repos='http://cran.rstudio.com/')

This seems to be a Linux-specific problem (Got message unable to load shared object stats.so when R starts, shared object ‘RCurl.so’ not found)
Does uninstalling and reinstalling the havenpackage fix it?

Related

Error installing the R package: CBNplot on github

I want to install the CBNplot package on GitHub:
Making the website:https://github.com/noriakis/CBNplot
Try two methods:
The first is direct download:
The following error occurs:
devtools::install_github("noriakis/CBNplot")
Installing package into ‘C:/Users/sjadsqf/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
installing source package 'CBNplot' ...
** using staged installation
** R
** data
** byte-compile and prepare package for lazy loading
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
Execution halted
ERROR: lazy loading failed for package 'CBNplot'
removing 'C:/Users/sjadsqf/Documents/R/win-library/4.1/CBNplot'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/sjadsqf/AppData/Local/Temp/RtmpMHHiTR/file555833c63074/CBNplot_0.99.2.tar.gz’ had non-zero exit status
Then I tried the second method
pkgbuild::build("D:/R/CBNplot-main",
dest_path = "D:/R/library/")
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
Execution halted
ERROR: lazy loading failed for package 'CBNplot'
removing 'C:/Users/sjadsqf/AppData/Local/Temp/Rtmp2F15K6/Rinst5c845a222d2f/CBNplot'
-----------------------------------
ERROR: package installation failed
Error in (function (command = NULL, args = character(), error_on_status = TRUE, ...:
! System command 'Rcmd.exe' failed
Exit status: 1
stdout & stderr:
i notice that error
Error: object 'choose.direction' is not exported by 'namespace:bnlearn'
So I tried to install belearn,After the installation is complete, the above error still appears in the operation
If you look at the changelog for the package bnlearn, it says
Version 4.8
...
removed choose.direction().
The lastest version of bnlearn therefore does not have the choose.direction function that the earlier versions had. Obviously, the CBNplot package uses this function, so the update in bnlearn has effectively broken the existing version of CBNplot.
The solution is to install an earlier version of bnlearn. For example, if I do
remove.packages('bnlearn')
devtools::install_version('bnlearn', version = '4.7')
devtools::install_github("noriakis/CBNplot")
and skip any package updates that are offered, I can install the package without difficulties.

Package or namespace failed

I'm trying to install the package 'microdadosBrasil' but I am with some problems. After the install.packages("remotes")
remotes::install_github("lucasmation/microdadosBrasil")
The program asks me to update de version and here commes the error:
It is recommended to update all of them.
Which would you like to update?
1: All
2: CRAN packages only
3: None
4: Rcpp (1.0.4 -> 1.0.4.6) [CRAN]
Enter one or more numbers, or an empty line to skip updates:
1
...
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'microdadosBrasil' in library.dynam(lib, package, package.lib):
DLL 'datatable' not found: maybe not installed for this architecture?
Erro: loading failed
Execução interrompida
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/Usuario/OneDrive/Documentos/R/win-library/3.6/microdadosBrasil'
Erro: Failed to install 'microdadosBrasil' from GitHub:
(convertido do aviso) installation of package ‘C:/Users/Usuario/AppData/Local/Temp/RtmpOO4bHT/file3a0479d3ee9/microdadosBrasil_0.0.0.9000.tar.gz’ had non-zero exit status
I have had that error on a few occasions. Usually using manually installing the package that R is stumbling over is sufficient to get past that point.
So I would try install.packages('i386') and if you get an error on that package, it may be informative. Often they are tied to underlying language interpreters or some kind of application you need installed.
If you see that error on the dependency keep drilling down until you find the root cause of the failure. Once you get that package or underlying language or application installed, you can work your way back up and all will be right in the world.

Installing xml2 in R in Fedora 27

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:
installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpPs5Gzi/downloaded_packages’
And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?
I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.
Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.
It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.
Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.
This is a bit hacky, but led to successful installation.
Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH
to R_HOME/etc/ldpaths.
I have solved this problem by install the ICU4C by source:
downloading ICU4C 58.2 from: ICU-Project
compiled
added the library location to $LD_LIBRARY_PATH,
the install will be work.

SparklyR installation issues ("Lazy loading failed")

Having some issues installing SparklyR on a Linux server using the same code that has been working smoothly up until yesterday. Have tried it with various combinations of DBI, jsonlite and dplyr installed/ uninstalled.
Everything seems to be running great up until this point:
* installing *source* package ‘sparklyr’ ...
** package ‘sparklyr’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Note: the specification for S3 class “AsIs” in package ‘jsonlite’ seems equivalent to one from package ‘DBI’: not turning on duplicate class definitions for this class.
Error in conformMethod(signature, mnames, fnames, f, fdef, definition) :
in method for ‘sqlParseVariables’ with signature ‘conn="spark_connection"’: formal arguments (conn = "spark_connection", sql = "spark_connection", ... = "spark_connection") omitted in the method definition cannot be in the signature
Error : unable to load R code in package ‘sparklyr’
ERROR: lazy loading failed for package ‘sparklyr’
Not sure if this has something to do with the GitHub commit on March 8, but loading the earlier version does not seem to help either. Any ideas?
This issue has now been addressed on the SparklyR GitHub page:
[...] a patch to sparklyr with version 0.5.3 was submitted and accepted to
CRAN today, it might take a day to fully replicate in CRAN but for
most users, a retry should fix this issue. This was caused by a
breaking change in DBI 0.6.
EDIT 2017-03-10: Can confirm that new patch is working.

Cannot install ggplot2: "Error in library.dynam(lib, package, package.lib) : shared object ‘stringi.so’ not found"

Last week I upgraded from Ubuntu 14.04 to 14.10. The first time I've tried to use ggplot in RStudio since the update, I'm getting dependancy errors with my ggplot package and its no longer registered as installed (was working fine before). When I try to reinstal ggplot2:
install.packages("ggplot2",dep=TRUE)
The installation fails while trying to install the dependencies. Here's what the tail of the output looks like:
* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
ERROR: lazy loading failed for package ‘stringr’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/stringr’
Warning in install.packages :
installation of package ‘stringr’ had non-zero exit status
ERROR: dependency ‘stringr’ is not available for package ‘reshape2’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/reshape2’
Warning in install.packages :
installation of package ‘reshape2’ had non-zero exit status
ERROR: dependency ‘reshape2’ is not available for package ‘ggplot2’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/ggplot2’
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpWNyAha/downloaded_packages’
I have a feeling this is the line (below) I should be looking at, but I'm not sure how to interprete this error, anyone have any suggestions for me? I really have no idea where to go from here, as I couldent find any other people experiencing the same error as me.
Error in library.dynam(lib, package, package.lib) :
shared object ‘stringi.so’ not found
Not sure if the Ubuntu upgrade I did relates to this... but I thought'd I'd mention it just in case.
Following #Nick Kennedey's comment, I tried installing stringi like this:
> install.packages("stringi",dep=TRUE)
Which resulted in this error I hadn't seen before:
2015-08-07 10:26:35 (256 KB/s) - ‘/tmp/RtmpQI4Uau/downloaded_packages/stringi_0.5-5.tar.gz’ saved [3639183/3639183]
ERROR: failed to lock directory ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1’ for modifying
Try removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/00LOCK-stringi’
Warning in install.packages :
installation of package ‘stringi’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpQI4Uau/downloaded_packages’
> install.packages("stringi",dep=TRUE)
So the I followed the suggestion in the error an removed the LOCK folder.
In the terminal: rm -r /home/james/R/x86_64-pc-linux-gnu-library/3.1/00LOCK-stringi’
Then tried installing the stringi package again, and it worked! This was the issue... now I've just finished installing with no issues.
I am still a little bit confused though... as to how this error can come about. Any ideas on what causes this so I can avoid it in the future? Is it possible it was a symptom of my recent upgrade to 14.10?
Got the same error while installing install.packages("knitr")
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/site-library/stringi/libs/stringi.so'
I solved it by doing the below:
In Ubuntu 16.04 and above
sudo apt install r-cran-stringi
In earlier versions (which had apt-get)
sudo apt-get install r-cran-stringi
In my case I solved the problem through installing stringi and ggplot2 from the terminal of linux. The problem has some relation with RStudio.

Resources