nvimcom did not automatically install, error with manual install
I'm using vim-plug with vim(v8.0.1098), have included,
Plug 'https://github.com/jalvesaq/Nvim-R.git'
in my .vimrc file, and in vim, ran :PlugInstall!, which seemed to install fine. But when I run R (v3.4.2), the package nvimcom does not exist. If inside R, I try, install.packages('nvimcom'), I get an error,
package ‘nvimcom’ is not available (for R version 3.4.2)
Do you have Rtools installed? Please, read the plugin's documentation: :h Nvim-R.
I'm on a Mac osx high Sierra. And my compilers (e.g., gcc++ clang, clang++) work. I have read through the documentation. Not sure what's going wrong. Would appreciate continued help in diagnosing.
I'm sorry, but I don't have access to any Mac OS X. Anyway, things that you could try:
-
Use Neovim instead of Vim.
-
Build nvimcom manually:
R CMD build /path/to/Nvim-R/R/nvimcom
R CMD INSTALL nvimcom_0.9-39.tar.gz
- Compare the values of some environment variables in both R running directly in the terminal emulator and R running within Neovim:
Sys.getenv("R_LIBS_USER")
Sys.getenv("R_HOME")
# etc...
Ok, I was able to build nvimcom manually per your suggestion above. When I run R directly in the terminal, I can successfully require("nvimcom"), which states that it is masking vi. But I'm not sure how to get vim to load and setup everything correctly. I've tried opening,
vim -v test.R
And then setting : let maplocalleader=","
then entering ,rf but nothing seems to happen.
Not sure whether this is relevant, but I've never created a .Rprofile as I've usually just installed using the osx build on cran.
You should either set maplocalleader in the vimrc or use the default LocalLeader: \.
Note that the plugin's documentation says that maplocalleader should be set before any other mapping command.
.Rprofile is not required.
I wonder if it's plugin conflict? Does this still occur with a minimal ~/.vimrc? For example, if you cut out everything and tried vim -u testrc? Also perhaps post your existing ~/.vimrc.
call plug#begin('~/.vim/plugged')
Plug 'jalvesaq/Nvim-R'
call plug#end()
" My configuration for Tmux.
let R_in_buffer = 0
let R_applescript = 0
let R_tmux_split = 1
@ssp3nc3r Is it working now?
Yes the combination of manually compiling/building and placing maplocalleader got it working. I assume that the scripts used to auto update nvimcom will continue to not work, however, and need to be updated for OSX. I'm unfamiliar with where they are or how they work, but I suspect that it has something to do with their handling of directories.
@ssp3nc3r Thanks for your feedback. I'm letting the issue open.
@ssp3nc3r Is nvimcom still not being automatically updated in your system? A user reported success in a Mac OS X: https://github.com/jalvesaq/Nvim-R/issues/269
@jalvesaq I was able to reproduce a similar error:
R CMD install nvimcom_0.9-56.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘nvimcom’ ...
** libs
/usr/local/bin/gcc -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nvimcom.c -o nvimcom.o
make: /usr/local/bin/gcc: No such file or directory
make: *** [nvimcom.o] Error 1
ERROR: compilation failed for package ‘nvimcom’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/nvimcom’
But then I remembered that I had altered ~/.R/Makevars in order to compile data.table. Might be worth it to check for the presence of ~/.R/Makevars and exit with a warning - although I'm unsure if that's also why users are having trouble compiling on OS X.
Thanks @frenchja !
I added a warning about ~/.R/Makevars if it exists.
I have a similar error install issue (centOS7, conda environment), solved with Yongchao Zhang's method: https://stackoverflow.com/questions/53813323/installing-r-packages-in-macos-mojave-error-in-if-nzcharshlib-libadd