Nvim-R icon indicating copy to clipboard operation
Nvim-R copied to clipboard

Cannot run 2 instances of nvim-R on same machine

Open dewoller opened this issue 4 years ago • 8 comments

Hi Jakson

Thank you so much for creating this package. My productivity is very good, because I am friends with my editor.

I am running nvim-R under neovim in Windows. Nvim-R It starts once, but if I try to run another concurrent instance, it fails, with the following error:


* installing to library 'C:/Users/XXXX/Documents/R/win-library/4.0'
* installing *source* package 'nvimcom' ...
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/Users/XXXX/Documents/R/win-library/4.0/nvimcom'
* restoring previous 'C:/Users/XXXX/Documents/R/win-library/4.0/nvimcom'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\XXXX\Documents\R\win-library\4.0\00LOCK-nvimcom\nvimcom\bin\x64\nclientserver.exe to C:\Users\XXXX\Documents\R\win-library\4.0\nvimcom\bin\x64\nclientserver.exe: Permission denied
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
  problem copying C:\Users\XXXX\Documents\R\win-library\4.0\00LOCK-nvimcom\nvimcom\libs\x64\nvimcom.dll to C:\Users\XXXX\Documents\R\win-library\4.0\nvimcom\libs\x64\nvimcom.dll: Permission denied

And then the message "Failed to install nvimcom"

This problem seems to be related to "Updating nvimcom". It tries to update nvimcom every time I open up nvim. Is there anyway to stop the updating of nvimcom?

Warmly Dennis

dewoller avatar Feb 02 '21 03:02 dewoller

Before starting R, Nvim-R compares the version registered at Nvim-R/R/nvimcom/DESCRIPTION with the version of nvimcom when R was run for the last time (the information is stored at ~/.cache/Nvim-R/nvimcom_info on Linux and at $APPDATA/Nvim-R/nvimcom_info on Windows). It also compares the current R version with the version of the last run R. The library nvimcom is updated only if there is a change in either nvimcom or R versions. That is, nvimcom should not be updated every time you start R.

jalvesaq avatar Feb 02 '21 04:02 jalvesaq

Hi @jalvesaq, thanks for the prompt response. I used your software again for several hours this morning, and I again spent some time appreciating all that it does for me. My intense gratitude kind sir!

On windows, the directory $APPDATA/Nvim-R/ does not have a file nvimcom_info. The directory has the following files:

 fun_*
omnils_* 
README 
path_to_nvimcom

The files have various timestamps, but only path_to_nvimcom has gets updated when I open R from neovim.

dewoller avatar Feb 03 '21 00:02 dewoller

I'm sorry, but I couldn't replicate the issue. I started R 4.0.3 within GVim 8.2 on Windows running in a virtual machine. Opened another R script in another GVim instance and the command <LocalLeader>rf started R immediately, without rebuilding nvimcom.

jalvesaq avatar Feb 03 '21 02:02 jalvesaq

Hi Jakson, @jalvesaq I also get this error when using multiple sessions. This happens to me quite often. I get the message:

Updating nvimcom... Building lists for omni completion... OK!

When I open another terminal and open an R file and press F2 , I see this:

* installing to library '/media/mr148/driveID/bioc-devel'
ERROR: failed to lock directory '/media/mr148/driveID/bioc-devel' for modifying
Try removing '/media/mr148/driveID/bioc-devel/00LOCK-nvimcom'

Most of the time I just delete the 00LOCK-nvimcom file and continue working.

Why does it need to check for an updated version and install? Could it just error out if the desired version number is not available e.g., via nvimcom >= 0.9.83? I will know I need to install it via GitHub.

Is it possible to write the code so that it expects the latest version of nvimcom and have users do the installation when it is not the case?

The alternative is to make sure that the installation was successful and remove the 00LOCK-nvimcom file.

Thanks!

LiNk-NY avatar Mar 11 '21 17:03 LiNk-NY

@jalvesaq Any updates on this? I still get this error message due to residual 00LOCK-nvicom file.

LiNk-NY avatar Mar 16 '21 19:03 LiNk-NY

The nvimcom is reinstalled when you upgrade either Nvim-R or R. You can run many instances of Nvim-R at the same time, but if you are running different R versions you may need to set different values of R_compldir (in Vim/Neovim) and and $R_LIBS_USER (in R).

jalvesaq avatar Mar 16 '21 22:03 jalvesaq

Usability is a bit better now after updating Nvim-R to the latest in this folder ~/.vim/bundle/Nvim-R (I'm using pathogen). I occasionally get the message when moving to another R file and pressing F2 but after re-trying, it works. I will look into what R_compldir does. Thank you.

LiNk-NY avatar Mar 18 '21 17:03 LiNk-NY

@dewoller and @LiNk-NY, this comment might be useful to you: https://github.com/jalvesaq/Nvim-R/issues/570#issuecomment-826013702

jalvesaq avatar Apr 29 '21 19:04 jalvesaq

Please, see: https://github.com/jalvesaq/Nvim-R/issues/775

jalvesaq avatar Nov 12 '23 11:11 jalvesaq