The problem here is that by default, OpenMPI does not register the library catalog with the system linker. That's why some installation guides recommend that you put your directories in your LD_LIBRARY_PATH variable so that libraries can be found at runtime. However, βadding directories to LD_LIBRARY_PATHβ should be done every time a new shell is loaded, so these guides suggest putting it in ~/.bashrc or the like so that this setting is restored every time you log in.
However, the ~/.bashrc (or ~/.profile or any such) is the setting for the user. Assuming that one of them is registered as root when installing openmpi and Rmpi, etc., which seems likely, this means that adding to these user files will only set library paths when working as root, and not like a regular runtime user.
The fix, in general, is to tell the linker where these files can be found. On my own system running CentOS 7, OpenMPI 1.10.0 (using RPM Scientific Linux), R 3.2.3, and Rmpi ββ0.6-5, this happens when I cannot set the library path:
[dchurch@workstation ~]$ R -q -e "library('Rmpi')" > library('Rmpi') Error : .onLoad failed in loadNamespace() for 'Rmpi', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib64/R/library/Rmpi/libs/Rmpi.so': libmpi.so.12: cannot open shared object file: No such file or directory Error: package or namespace load failed for 'Rmpi' Execution halted
If I temporarily set the linker path with a temporary variable, it works for this call:
[dchurch@workstation ~]$ LD_LIBRARY_PATH=/usr/lib64/openmpi/lib R -q -e "library('Rmpi')" > library('Rmpi') > >
However, to make this change permanent, the best way to do this is to register the openmpi library directory with the system builder itself, create a new file in /etc/ld.so.conf.d and run ldconfig like this:
[dchurch@workstation ~]$ sudo sh -c 'echo /usr/lib64/openmpi/lib > /etc/ld.so.conf.d/openmpi.conf; ldconfig' [dchurch@workstation ~]$ R -q -e "library('Rmpi')" > library('Rmpi') > >
Once you have done this, Rmpi ββshould be downloaded for any user, regardless of the environment variables.