I want to to install bibutils using R on my pc. With unix/ubuntu, I can use "sudo apt-get install bibutils" which works great. I tried using R shell to do the same:
shell('sudo apt-get install bibutils')
and got the following errors:
'sudo' is not recognized as an internal or external command,
operable program or batch file.
Warning messages:
1: running command 'C:\WINDOWS\system32\cmd.exe /c sudo apt-get install
bibutils' had status 1
2: In shell("sudo apt-get install bibutils") :
'sudo apt-get install bibutils' execution failed with error code 1
Is there a better way to do this? Thanks.
Related
I am trying to install R library for Facebook's prophet on centOS 7. For easy reproducibility, I am providing a dockerfile and commands.
FROM centos:7
RUN yum -y install epel-release
RUN yum -y groupinstall "Development Tools"
RUN yum -y install proj
RUN yum -y install udunits2-devel
RUN yum -y install openssl-devel
RUN yum -y install libjpeg-turbo-devel
RUN yum -y install libcurl-devel
RUN yum -y install v8-devel
RUN yum -y install R
To build the dockerfile, use following command.
docker build -t test_prophet_installation .
Once it is built, I run the container using this next command.
docker run -it --entrypoint=/bin/bash test_prophet_installation
Now, I am inside my container. I tried to install prophet using below command.
su - -c "R -e \"install.packages('prophet', repos='http://cran.rstudio.com/')\""
The above command said, one of the dependencies of prophet i.e rstan failed to install. So I tried to install 'rstan' using the following command.
su - -c "R -e \"install.packages('rstan', repos='http://cran.rstudio.com/')\""
After running the above command, I got the following error.
Error in .shlib_internal(args) :
C++14 standard requested but CXX14 is not defined
* removing '/usr/lib64/R/library/rstan'
The downloaded source packages are in
'/tmp/RtmpsPDQ9G/downloaded_packages'
Updating HTML index of packages in '.Library'
Warning messages:
1: In install.packages("rstan", repos = "http://cran.rstudio.com/") :
installation of package 'rstan' had non-zero exit status
2: In file.create(f.tg) :
cannot create file '/usr/share/doc/R-3.6.0/html/packages.html', reason 'No such file or directory'
3: In make.packages.html(.Library) : cannot update HTML package index
I tried almost all the troubleshooting from Google to solve above error still no luck. I think, I am not setting some environment variable correctly.
The problem here is that when using the yum groupinstall "Development Tools", the installed gcc is 4.8.5 and therefore does not support C++14 (as you can see here).
In order to solve this you need to add the following:
RUN yum -y install centos-release-scl
RUN yum -y install devtoolset-8-gcc*
RUN scl enable devtoolset-8 sh
on top of this, you have to define the Makevars for rstan. You can find an explanation here: https://github.com/stan-dev/rstan/issues/569
I created this Makevars:
CXX14 = g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC
and added a COPY in my Dockerfile:
COPY Makevars /root/.R/Makevars
I'm using the following command to download the packages:
install.packages('rstan', repos='http://cran.rstudio.com/', dependencies = TRUE)
Some things are still not working as expected but it's a step forward.
EDIT:
this approach does not work since the system keeps using the old g++. I ended up using the docker image centos/devtoolset-7-toolchain-centos7:latest.
According to the venv documentation in Python3:
Changed in version 3.5: The use of venv is now recommended for creating virtual environments.
With Python3.6 installed in my Ubuntu 16, I tried to create a Python project with command python3 -m venv project, but got the following error:
Error: Command '['/home/me/git/project/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Question: Why could this have happened? and how to resolve?
sudo apt-get install -y python3-pip is worth a try, based on https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-an-ubuntu-16-04-server
If that fails, what does python3 --version print?
I created a new ubuntu-16.04.2-desktop-amd64 machine on VM VirtualBox and I want to be able to use the R environment with Rmpi.
Both of the below approaches gives a similar error.
Updated simplified pre-build binary approach:
When Ubuntu had installed I opened a terminal and executed the following commands:
~$ sudo apt-get update
~$ sudo apt-get install openmpi-bin
~$ sudo apt-get install r-base
~$ sudo apt-get install r-cran-rmpi
~$ R
This opened the R terminal and I invoking the follow function which resulted in an error:
> library(Rmpi)
libmpi.so: cannot open shared object file: No such file or directory
Error : .onLoad failed in loadNamespace() for 'Rmpi', details:
call: fun(libname, pkgname)
error: Cannot start MPI_Init(). Exit
Error: package or namespace load failed for ‘Rmpi’
Alternative approaches that I have attempted include using a local OpenMPI installation and using the R function install.packages to install the Rmpi package (see below). These all resulted in the same error.
I have also tried using MPICH by substituting ~$ sudo apt-get install mpich as the second command in the above procedure (including using the R function for installing the package) which results in an even more onerous runtime error.
Does anyone know what I have done wrong or what I can do to resolve this installation error?
Or alternatively, have anyone been able to successfully install a VirtualBox machine with Rmpi using any Linux distro or an image with pre-installed components?
Original local installation approach:
I have followed the instructions on this blog to download OpenMPI version 2.1.0, compile and install it. However when I try to install the package in R with:
> install.packages("Rmpi", configure.args =
c("--with-Rmpi-include=/home/jormunr/openmpi/include",
"--with-Rmpi-libpath=/home/jormunr/openmpi/lib",
"--with-Rmpi-type=OPENMPI",
"--with-mpi=/home/jormunr/openmpi/"))
it gives the following error
Error: .onLoad failed in loadNamespace() for 'Rmpi', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/jormunr/R/x86_64-pc-linux-gnu-library/3.2/Rmpi/libs/Rmpi.so':
libmpi.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
I can see that the 'libmpi.so.20' file is in the /home/jormunr/openmpi/lib that I provided as one of the parameter to the installation.
[Disclaimer: I am not a Linux expert and merely have user level skills. Any contributions or corrections from an expert will be greatly appreciated.]
Pre-build Binary Approach
Although trying various ways to install the prebuilt binaries I did not manage to get this option to work. This involved executing in the terminal the command 'sudo apt-get install r-cran-rmpi' to install the r-cran-rmpi prebuilt packages which also automatically installs the libopenmpi1.10 package that is a listed prerequisite. However, it appears that the file 'libmpi.so' is not included in the libopenmpi1.10 package but expected by the Rmpi library which causes an error in the R environment that it cannot find this file.
Local Installation Approach
The local installation did eventually succeed with a few amendments. I created a new ubuntu-16.04.2-desktop-amd64 VirtualBox image with default settings, except for 2048MB of memory and 32GB of hard drive space. When installed I opened a terminal and executed the commands from the Jovinge Lab website with the inclusion of the penultimate command which amends the run-time link editor's path and enables the install.package() function of R to find the 'libmpi.so' file. (also changed the version to 1.10.6 as this is the latest version release of version 1 – see below for version 2)
~$ cd /home/jormunr
~$ wget https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.2.tar.gz
~$ tar -zxvf openmpi-1.10.6.tar.gz
~$ cd openmpi-1.10.2
~$ ./configure --prefix=/home/jormunr
~$ make
~$ make install
~$ sudo apt-get install r-base
~$ export LD_LIBRARY_PATH=/home/jormunr/lib:$LD_LIBRARY_PATH
~$ R
This opens an R terminal and I invoked the function:
> install.packages("Rmpi", configure.args =
+ c("--with-Rmpi-include=/home/jormunr/include/",
+ "--with-Rmpi-libpath=/home/jormunr/lib/",
+ "--with-Rmpi-type=OPENMPI",
+ "--with-mpi=/home/jormunr/"))
This now executed without errors and I could test it with the following R statements:
> library("Rmpi")
> mpi.spawn.Rslaves()
master (rank 0, comm. 1) of size 2 is running on: Valhalla
slave1 (rank 1, comm. 1) of size 2 is running on: Valhalla
> mpi.close.Rslaves()
[1] 1
> mpi.quit()
When I tried this process with the OpenMPI Version 2.1.0 the installation completed successfully but the above test had issues; the mpi.spawn.Rslaves() function completed but mpi.close.Rslaves() did not complete – it never returned and the terminal was left hanging.
I experienced similar challenges. I landed on this solution where libopenmpi-dev was the secret.
sudo apt-get install openmpi-common openmpi-bin libopenmpi-dev r-base
sudo apt-get install r-cran-rmpi
sudo su
R
install.packages("doMPI", dependencies=TRUE)
I try to follow the guide bellow to install .net core on my raspberry pi 3:
https://www.microsoft.com/net/core#debian
The script told me to install below:
dotnet_install: Error: Unable to locate libunwind. Install libunwind to continue
dotnet_install: Error: Unable to locate gettext. Install gettext to continue
i install them using apt-get install, and everything fine:
sudo apt-get install libunwind-dev
sudo apt-get install gettext
but no luck, when i run below :
sudo curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
i got:
dotnet_install: Error: Download failed
Are there any missing?
Please use last valid URL:
curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet
And it downloads and installs successfully on latest Raspbian on Raspberry Pi 2 (I think there should be no problem with Raspberry Pi 3).
However, after successful install, there is a error:
bash: dotnet: cannot execute binary file: Exec format error
I believe this is because of ARM architecture, because currently only amd64 (x64) is supported.
I am trying to instal daemon on Unix via the apt-get command. When I run the command
apt-get install daemon
I get
apt-get: command not found
Does anyone have nay ideas about how to fix this.
apt-get is not on OS X by default. However, you can tweak it a little bit by using Fink so that you get the Debian packages.