Rmpi - error: : unable to load shared object 'C:/Program Files/R/R-4.0.4/library/Rmpi/libs/x64/Rmpi.dll':

Hello community,

I'm trying to install Rmpi https://cran.r-project.org/web/packages/Rmpi/index.html in Windows 10.
I have installed MPICH2, because I want to be able to run parallel processing.
After following all steps, I'm trying to load Rmpi library in RStudio (R 4.0.4) but I get this error.

> library(Rmpi)
Error: package or namespace load failed for ‘Rmpi’:
 .onLoad failed in loadNamespace() for 'Rmpi', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Program Files/R/R-4.0.4/library/Rmpi/libs/x64/Rmpi.dll':
  LoadLibrary failure: The specified module could not be found..

My PATH variable has ""C:\Program Files\R\R-4.0.4\bin\x64" in it.
R_LIBS_USER: C:/Users/vfota/Documents/R/win-library/4.0

I assume it's something in environment variables.
I don't really know what else to provide to you, so, please inform me in regard to this.
Thanks in advance :slight_smile:

Instructions for running RMPI with MPICH2 are given here: http://fisher.stats.uwo.ca/faculty/yu/Rmpi/windows2.htm

But since it's a Windows machine, you might have better luck installing Microsoft MPI and using that. Instructions are on that same site.

I followed those exact instructions but it seems that the problem was with MPICH2, as MPI worked better as I am able to load Rmpi. However, following these instructions for MPI http://fisher.stats.uwo.ca/faculty/yu/Rmpi/windows.htm, I get an error when I'm creating the shortcut "C:\Program Files\Microsoft MPI\Bin\mpiexec.exe" -n 1 "C:\Program Files\RStudio\bin\rstudio.exe". The error is 'C:/Program' is not recognized as an internal or external command, operable program or batch file..

Is there any possibility that you are familiar with its solution?

That's certainly a problem with getting the quote-marks correct, as the message is saying that it thinks "C:/Program" is the name of the program you're trying to run. Depending on what you're trying to do, escaping the quotes may work. How are you trying to create the shortcut?

The line of shortcut proposed is
"C:\Program Files\Microsoft MPI\Bin\mpiexec.exe" -n 1 "C:\Program Files\RStudio\bin\rstudio.exe"
I have tried the following ways:

  1. Direct copy-paste of the line as proposed in the instructions via desktop->right click create shortcut and open Rstudio with it. It works as far as importing Rmpi, but produces the error mentioned.

  2. Creating a txt file, copy-paste the line, and changing the extension to cmd to open Rstudio with it. Reproduces the result above.

  3. Creating the same cmd command shortcut as bullet 2, but giving program files the DOS name as PROGRA~1. Same error again.

  4. Creating the cmd as:
    C:\"Program Files"\"Microsoft MPI"\Bin\mpiexec.exe (hitting enter to go to second line)
    C:\"Program Files"\RStudio\bin\rstudio.exe"
    Same again.

  5. I didn't try << cd C:\prog*\Microsoft MPI\Bin\mpiexec.exe >> or something like this

I pasted your line into a shortcut and was able to launch without any problems, so I don't know. I do notice the error message you posted has a forward-slash after the colon rather than a backslash. That may indicate that the shortcut is launching properly and there's something odd going on with your RStudio.

@benfulton I am facing a similar challenge. I installed MPICH2 and it shows its running and Rmpi was installed successfully in R using a guide from here Installing Rmpi (MPI for R) on Mac and Windows | Bioinfomagician . The problem is when I run the command mpi.spawn.Rslaves() to check whether Rmpi has installed successfully, I get the following error

Error in mpi.comm.spawn(slave = system.file("Rslaves64.cmd", package = "Rmpi"), : Internal MPI error!, error stack: MPI_Comm_spawn(cmd="C:/Users/HP PROBOOK 450 G5/Documents/R/win-library/4.1/Rmpi/Rslaves64.cmd", argv=0x000001F360891C10, maxprocs=8, MPI_INFO_NULL, root=0, MPI_COMM_SELF, intercomm=0x000001F357009538, errors=0x000001F358194C98) failed
Internal MPI error! FAILspawn not supported without process manager

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.