This is how I tried installing tensorflow using R studio.
install.packages("tensorflow")
library(tensorflow)
install_tensorflow()
This is the error that I am getting:
>> library(tensorflow)
>> install_tensorflow()
Preparing for installation (updating pip if necessary)
E:\python\python.exe: No module named pip
Error: Error 1 occurred updating pip
In addition: Warning message:
running command '"E:\python\python.exe" -m pip install --upgrade pip' had status 1
Has anyone got any idea on what to do?
Check , if python is installed on your machine. If not, install it and try to install tensorflow again
Related
I am fairly new to R studio, any help would be appreciated. I am installing r studio on my Mac, I am getting an error while trying to install tensorflow
devtools::install_github("rstudio/tensorflow")
library(tensorflow)
install_tensorflow()
I get this error
Error: Prerequisites for installing TensorFlow not available.
Execute the following at a terminal to install the prerequisites:
$ sudo /usr/bin/easy_install pip
$ sudo /usr/local/bin/pip install --upgrade virtualenv
Any help would be appreciated thank you!
From the official Rstudio website:
TensorFlow is distributed as a Python package and so needs to be
installed within a Python environment on your system. By default, the
install_tensorflow() function attempts to install TensorFlow within
it’s own isolated Python environment (“r-tensorflow”).
And the python installation mostly relies on pip for installing it's dependencies. As the error message suggests, install pip and upgrade the virtualenv and see if that fixes the issue.
In order to install the greta package, I need to first install tensorflow-probability. Tensorflow and Python 3.7 Anaconda are already installed.
When I attempt the following command in R: reticulate::conda_install("r-tensorflow", "tensorflow-probability", pip = TRUE), I get the following:
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied:
'C:\\Users\\PHILTE~1\\ANACON~1\\envs\\r-tensorflow\\Lib\\site-packages\\numpy\\core\\multiarray.cp36-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
I have admin permissions on my laptop, so I'm unsure why I'm getting an access denied. But how do I add the --user command within the reticulate command?
This webpage fixed it all for me: http://preposterior.updog.co/november-8-2018-getting-your-computing-environment-ready-for-greta.html#november-8-2018-getting-your-computing-environment-ready-for-greta
Steps:
Install Anaconda
Open Anaconda Prompt and run the following:
conda activate r-tensorflow
pip install --no-dependencies tensorflow-probability==0.4.0
conda install tensorflow=1.11
pip install h5py pyyaml requests Pillow scipy
Back in R, install the greta package from CRAN.
From version 0.4.0, greta now includes a install_greta_deps() function that installs all the relevant python modules required for greta.
You can learn more here:
https://greta-stats.org/articles/get_started.html
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've recently started using R. Each time I start R (either in the terminal or in RStudio) I get the following error,
Error: 1:17: unexpected '{'
1: f(interactive()){`
Furthermore this error prevents me from being able to install any packages as any attempt to do so returns,
Execution halted
Warning in install.packages :
installation of package ‘stringi’ had non-zero exit status
Error: 1:17: unexpected '{'
1: f(interactive()){
I've tried to google the error but I've not found any results relating to this problem. I've tried reinstalling R but the problem persists.
I'm using Linux Mint 17.2.
This is what I did to install R
sudo vim /etc/apt/sources.list
And I added the line
deb http://cran.rstudio.com/bin/linux/ubuntu precise/
Then,
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base
Any help would be really appreciated, thank you for your time.
Do you have a .Rprofile file? It looks like somebody accidentally changed if(interactive()){ to f(interactive()){
I have Ubuntu 10.x OS and I have installed R on it. I want to install rJava on R. For that when I am running installed.packages("rJava) command which is giving error
checking whether Java run-time works... Error: Could not find or load main class getsp
no
configure: error: Java interpreter '/usr/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/hduser/R/i486-pc-linux-gnu-library/2.10/rJava’
The downloaded packages are in
‘/tmp/Rtmp0tlBXn/downloaded_packages’
Warning message:
In install.packages("rJava") :
installation of package 'rJava' had non-zero exit status
If I run system("java -version")
Then it showing same Java version which is given when I run Java -version command from base OS prompt. So it means no problem with Java which I can see reason in output of install package command? As suggested when I use
sudo apt-get install r-cran-rjava
Here also didnt get any luck
Please suggest
I just saw that you wrote installed.packages instead of install.packages, you have to use install.packages("rJava") to install it.
The description of the method you used (installed.packages) says: Find (or retrieve) details of all packages installed in the specified libraries.
Can you please try
install.packages("rJava")
library(rJava)
and tell me the output? (I'm pretty sure it will already work then).
in the terminal run sudo apt-get install default-jdk
then run sudo R CMD javareconf
after that you can continue in R or Rstudio install.packages("rJava")