Failed to create bus connection; running command 'timedatectl' had status 1 - r

I'm using WSL2.
In R, I tried to install packages. For example:
> install.packages("tidyverse")
But I'm getting a Failed to create bus connection error.
Traceback:
Failed to create bus connection: No such file or directory
Warning in system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Failed to create bus connection: No such file or directory
Warning in system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1
** testing if installed package can be loaded from final location
Failed to create bus connection: No such file or directory
Warning in system("timedatectl", intern = TRUE) :
running command 'timedatectl' had status 1
** testing if installed package keeps a record of temporary installation path
* DONE (tidyverse)
The downloaded source packages are in
‘/tmp/RtmpD1g9KP/downloaded_packages’
I've tried to install the dbus package:
sudo apt-get update
sudo apt-get install dbus
And am still getting the error after reboot.
I also tried:
sudo systemctl status
but it returns:
System has not been booted with systemd as init system (PID 1). Can't operate.

In .bashrc, or in some other alias file, add a variable for TZ. For me, I did
export TZ="America/New_York"
Then reload bash and it should recognize the timezone. You can see more about the timezone names here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Related

error in installation of tidyverse package in R

I am facing an error during the installation of tidyverse R package. The R version is 4.2.0 and OS is ubuntu 22.04 (in windows host OS). I have used the following command in R for the installation:
install.package("tidyverse",dependencies=TRUE)
After the installation when I called the library using library(tidyverse), it gives an error:
System has not been booted with systemd as init system (PID 1). Can't
operate. Failed to connect to bus: Host is down
along a warning message: `
Warning message:In system("timedatectl", intern = TRUE) : running
command 'timedatectl' had status 1
`
Kindly help troubleshoot the error.

R install package stringi in renv

I am trying to install the package stringi with renv::install().
Normally, I would use
install.packages('stringi', configure.vars='ICUDT_DIR=path/to/icudt61l.zip/')
To specify the location of icudt61l.zip dependency.
How can I do this in renv ?
I tried to add ICUDT_DIR='path/to/icudt61l.zip/' in my .Rprofile but it didn't work.
Any idea how to tell renv where is ICU to install stringi ?
Here is the error I get
> renv::install("stringi")
...
Installing stringi [1.6.2] ...
FAILED
Error installing package 'stringi':
===================================
...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /opt/R/4.0.3/lib/R
checking for R... /opt/R/4.0.3/lib/R/bin/R
...
checking with pkg-config for the system ICU4C... 50.1.2
checking for ICU4C >= 55... no
*** ICU4C 50.1.2 has been detected
*** Minimal requirements, i.e., ICU4C >= 55, are not met
*** Trying with 'standard' fallback flags
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... no
*** This version of ICU4C cannot be used.
*** Using the ICU 69 bundle.
checking whether we may compile src/icu69/common/putil.cpp... yes
checking whether we may compile src/icu69/i18n/number_affixutils.cpp... yes
checking whether alignof(std::max_align_t) is available... no
checking whether alignof(::max_align_t) is available... yes
checking whether the ICU data library can be downloaded... downloading the ICU data library (icudt)
output path: icu69/data/icu4c-69_1-data-bin-l.zip
trying URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
trying URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb"): cannot open URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
icudt download failed
Error: Stopping on error
In addition: Warning messages:
1: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
2: In download.file(paste(href, fname, sep = ""), icudtzipfname, mode = "wb") :
URL 'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip': status was 'Couldn't connect to server'
Execution halted
*** *********************************************************************
*** stringi cannot be built.
*** Failed to download the ICU data library (icudt). Stopping now.
*** For build environments that have no internet access,
*** see the INSTALL file for a workaround.
*** *********************************************************************
ERROR: configuration failed for package ‘stringi’
* removing ‘/var/projects/iml/GDCFA21N/avertie_test/renv/staging/2/stringi’
Error: install of package 'stringi' failed [error code 1]
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
just use this command, can be load ICUDT from local.
if you run this all have ERROR,in icudt cannot connect.You should follow this https://raw.githubusercontent.com/gagolews/stringi/master/INSTALL.
follow like this:
ICU Data Library and No Internet Access
Note that if you choose to use our ICU4C bundle, then -- by default -- the
ICU data library will be downloaded from one of our mirror servers.
However, if you have already downloaded a version of icudt*.zip suitable
for your platform (big/little endian), you may wish to install the
package by calling:
install.packages("stringi", configure.vars="ICUDT_DIR=<icudt_dir>")
Moreover, if you have no internet access on the machines
you try to install stringi on, try fetching the latest development version
of the package, as it is shipped with the ICU data archives.
You can build a distributable source package that includes all the required
ICU data files (for off-line use) by omitting some relevant lines in
the .Rbuildignore file. The following command sequence should do the trick:
wget https://github.com/gagolews/stringi/archive/master.zip -O stringi.zip
unzip stringi.zip
sed -i '/\/icu..\/data/d' stringi-master/.Rbuildignore
R CMD build stringi-master
Assuming the most recent development version of the package is numbered x.y.z,
a file named stringi_x.y.z.tar.gz is created in the current working directory.
The package can now be installed (the source bundle may be propagated via
scp etc.) by executing:
R CMD INSTALL stringi_x.y.z.tar.gz
Alternatively, call from within an R session:
install.packages("stringi_x.y.z.tar.gz", repos=NULL)
From ?renv::install:
Package Configuration:
Many R packages have a 'configure' script that needs to be run to
prepare the package for installation. Arguments and environment
variables can be passed through to those scripts in a manner
similar to install.packages. In particular, the R options
'configure.args' and 'configure.vars' can be used to map package
names to their appropriate configuration. For example:
# installation of RNetCDF may require us to set include paths for netcdf
configure.args = c(RNetCDF = "--with-netcdf-include=/usr/include/udunits2"))
options(configure.args = configure.args)
renv::install("RNetCDF")
Similarly, additional flags that should be passed to R CMD INSTALL
can be set via the 'install.opts' R option:
# installation of R packages using the Windows Subsystem for Linux
# may require the `--no-lock` flag to be set during install
options(install.opts = "--no-lock")
renv::install("xml2")
Setting something like:
options(configure.vars = list(stringi = "ICUDT_DIR=path/to/icudt61l.zip"))
should hopefully get you unstuck.

In R (and when installing ROracle package), how do I set OCI_LIB64?

In R (and when installing ROracle package), how do I set OCI_LIB64? I've downloaded Oracle Instant Client and have pointed the wd and the OCI_LIB64 to that. I have Windows 10 Enterprise. It's RStudio version 1.1.463 and R version 3.4.3.
I tried the following:
setwd('C:\\Users\\sriley03\\Documents\\') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
install.packages('ROracle_1.3-1.tar.gz', repos = NULL)
but I get the following output and errors:
> setwd('C:\\Users\\sriley03\\Documents\\') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/ inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.Error: unexpected symbol in "set OCI_LIB64"
> setwd('C:\\Users\\sriley03\\Documents\\instantclient_19_3') # set to path of download (remember to escape slashes ie: c:\\users\\etc..)
The working directory was changed to C:/Users/sriley03/Documents/instantclient_19_3 inside a notebook chunk. The working directory will be reset when the chunk is finished running. Use the knitr root.dir option in the setup chunk to change the working directory for notebook chunks.> set OCI_LIB64=C:\Users\sriley03\Documents\instantclient_19_3
Error: unexpected symbol in "set OCI_LIB64"
> install.packages('ROracle_1.3-1.tar.gz', repos = NULL)
Warning: invalid package 'ROracle_1.3-1.tar.gz'
Error: ERROR: no packages specified
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" "ROracle_1.3-1.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘ROracle_1.3-1.tar.gz’ had non-zero exit status
What can I do so that I can set OCI_LIB64 properly so that I can install ROracle?
Thanks!
UPDATE (8_28_19):
I've set the OCI_LIB64 and the OCI_INC to the correct paths
Sys.setenv(OCI_LIB64="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")
Sys.setenv(OCI_INC="C:\\Users\\sriley03\\Documents\\oreclient_install_dir\\instantclient_19_3")
But now I get the following response (even though all the required headers are in that file):
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
Oracle Client Shared Library 64-bit - 19.3.0.0.0 Operating in Instant Client mode.
found Oracle Client C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
found Oracle Client include C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3
ERROR: cannot find Oracle Client include headers in C:\Users\sriley03\Documents\oreclient_install_dir\instantclient_19_3.
Please set OCI_INC to correct location.
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Program Files/R/R-3.4.3/library/ROracle'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.3/bin/x64/R" CMD INSTALL -l "C:\Program Files\R\R-3.4.3\library" C:\Users\sriley03\AppData\Local\Temp\RtmpWUfabz/downloaded_packages/ROracle_1.3-1.tar.gz' had status 1
Try to download the SDK Package from Oracle and unzip it in your instant client folder.
set the environment variable OCI_INC to the 'include' folder located in your instant client folder: ..."instantclient_xx_x\sdk\include"
Then, reinstall the packages.
If you still get a failure error, try to copy all files from sdk\include folder to your R include folder, then try again

Error in installing car package in R

While installing "car" package in Rstudio in Ubuntu, I faced an error saying that dependencies "nloptr","lme4" and one more, are not installed.
So I started installing "nloptr" but I faced this error-
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-
2.4.2.tar.gz", :
cannot open URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
'/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to
/tmp/RtmpSeLv7g/R.INSTALL18a67910d582/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
System hangs after last line and when I restart after some time, "nloptr" is not installed and hence I am unable to install "car" package.
Please help me. Thanks in advance.
I was encountering the same problem under R (pure R 3.2.3 on Linux Debian). I was first blocked by another issue during the same installation : the installation process failed to lock directory ~/.../R/x86_64.../3.2 and suggested to remove ~/.../R/x86_64.../3.2/00LOCK-nloptr . I did it, restart the car package installation, and then it blocked at the same point: it needs nlopt.h.
So, I installed libnlopt-dev (sudo apt-get install libnlopt-dev) and re-restart the car installation ... and then it worked.
Ok, this is under linux, but perhaps should you try to focus on installing something about NLOPT under windows.
Good luck.

Error starting OpenCPU in rstudio OnAttach failed

I am trying to get a simple OpenCPU Apps (from https://www.opencpu.org/download.html).
Since I am on Ubuntu on AWS, I follow the instructions for Ubuntu:
# Requires Ubuntu 14.04 (Trusty) or 16.04 (Xenial)
sudo add-apt-repository -y ppa:opencpu/opencpu-1.6
sudo apt-get update
sudo apt-get upgrade
# Installs OpenCPU server
sudo apt-get install -y opencpu
# Done! Open http://yourhost/ocpu in your browser
# Optional: installs rstudio in http://yourhost/rstudio
sudo apt-get install -y rstudio-server
Goes through all right.
Next I try to install the package in Rstudio:
install.packages("opencpu")
Installing package into ‘/home/ruser/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/opencpu_1.6.1.tar.gz'
Content type 'unknown' length 563159 bytes (549 KB)
==================================================
downloaded 549 KB
* installing *source* package ‘opencpu’ ...
** package ‘opencpu’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (opencpu)
The downloaded source packages are in
‘/tmp/RtmpON3Ujv/downloaded_packages’
> library(opencpu)
Initiating OpenCPU server...
Using config: /home/ruser/.opencpu.conf
OpenCPU started.
[httpuv] http://myserver/rstudio/p/1529/ocpu
Error : .onAttach failed in attachNamespace() for 'opencpu', details:
call: rhttpd$init()
error: could not find function "startDynamicHelp"
Error: package or namespace load failed for ‘opencpu’
This is where I get the error. Tried googling the error but no luck.
#gaurav is correct. The instructions on opencpu are very misleading, because it looks like they're showing a single set of instructions, but in fact, the R commands are for running opencpu in an interactive R session, not with your newly installed opencpu cloud server.
To run the sample apps on your new cloud server (which is what I assume you are trying to do), you need to follow the instructions for the cloud server.
Here's the link to the cloud server docs that helped me:
https://cran.r-project.org/web/packages/opencpu/vignettes/opencpu-server.pdf
Specifically, to run the sample apps, you'll need to start an R session as root, and install the packages:
sudo -i
R
#then from r session
library(devtools)
install_github("opencpu/gitstats")
install_github("opencpu/stocks")
#then quit
quit()
exit
then restart the opencpu service:
sudo service opencpu restart
then, you can navigate to the package using the opencpu api. In a web browser, go to:
http://localhost/ocpu/library/gitstats/www/
and voila-

Resources