williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Cannot install r_server_language #604

Closed KryeKuzhinieri closed 2 years ago

KryeKuzhinieri commented 2 years ago

Problem description

I recently migrated from vim to neovim where I am using the Astro Vim configuration. Everything works fine besides the r_server_language which throws an error.

Neovim version (>= 0.6)

NVIM v0.6.0 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Operating system/version

Linux kuzhina 5.13.0-39-generic #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

r_server_language

Actual behavior

Initially, I wanted to install the language server by running

:LspInstall r_server_language

However, I got the following error:

    ◍ r_language_server (failed)

        R version 4.1.3 (2022-03-10) -- "One Push-Up"
        Copyright (C) 2022 The R Foundation for Statistical Computing
        Platform: x86_64-pc-linux-gnu (64-bit)

        R is free software and comes with ABSOLUTELY NO WARRANTY.
        You are welcome to redistribute it under certain conditions.
        Type 'license()' or 'licence()' for distribution details.

          Natural language support but running in an English locale

        R is a collaborative project with many contributors.
        Type 'contributors()' for more information and
        'citation()' on how to cite R or R packages in publications.

        Type 'demo()' for some demos, 'help()' for on-line help, or
        'help.start()' for an HTML browser interface to help.
        Type 'q()' to quit R.

        > options(langserver_library = "/home/user/.local/share/nvim/lsp_servers/r_language_server.tmp");
        > options(repos = list(CRAN = "http://cran.rstudio.com/"));
        > rlsLib <- getOption("langserver_library");
        > 
        > didInstallRemotes <- FALSE;
        > tryCatch(
        +   expr = { library("remotes") },
        +   error = function (e) {
        +     install.packages("remotes", lib = rlsLib);
        +     loadNamespace("remotes", lib.loc = rlsLib);
        +     didInstallRemotes <- TRUE;
        +   }
        + );
        > 
        > remotes::install_github("jozefhajnala/languageserversetup", lib = rlsLib);
        Downloading GitHub repo jozefhajnala/languageserversetup@HEAD

   checking for file ‘/tmp/RtmpavrCHy/remotesee1e7e9b239f/jozefhajnala-languageserversetup-3daf44a/DESCRIPTION’ ...

✔  checking for file ‘/tmp/RtmpavrCHy/remotesee1e7e9b239f/jozefhajnala-languageserversetup-3daf44a/DESCRIPTION’

─  preparing ‘languageserversetup’:
           checking DESCRIPTION meta-information ...

✔  checking DESCRIPTION meta-information

─  checking for LF line-endings in source and make files and shell scripts

─  checking for empty or unneeded directories
           Omitted ‘LazyData’ from DESCRIPTION

─  building ‘languageserversetup_0.1.2.900.tar.gz’

* installing *source* package ‘languageserversetup’ ...
        ** using staged installation
        ** R
        ** inst
        ** byte-compile and prepare package for lazy loading
        ** help
        *** installing help indices
        ** building package indices
        ** testing if installed package can be loaded from temporary location
        ** testing if installed package can be loaded from final location
        ** testing if installed package keeps a record of temporary installation path
        * DONE (languageserversetup)
        > 
        > if (didInstallRemotes) {
        +     remove.packages("remotes", lib = rlsLib);
        + }
        > 
        > loadNamespace("languageserversetup", lib.loc = rlsLib);
        <environment: namespace:languageserversetup>
        > languageserversetup::languageserver_install(
        +     fullReinstall = TRUE,
        +     confirmBeforeInstall = FALSE,
        +     strictLibrary = TRUE
        + );
        trying URL 'http://cran.rstudio.com/src/contrib/remotes_2.4.2.tar.gz'
        Content type 'application/x-gzip' length 152540 bytes (148 KB)
        ==================================================
        downloaded 148 KB

        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error in tools:::.install_packages() : 
          current working directory cannot be ascertained
        sh: 0: getcwd() failed: No such file or directory

        The downloaded source packages are in
            ‘/tmp/RtmpavrCHy/downloaded_packages’
        Downloading GitHub repo REditorSupport/languageserver@master
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error: Failed to install 'languageserver' from GitHub:
          Could not find tools necessary to compile a package
        Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
        In addition: Warning message:
        In utils::install.packages("remotes", lib = rlsLib) :
          installation of package ‘remotes’ had non-zero exit status
        Execution halted
        spawn: R failed with exit code 1

Then, I tried installing the packages manually by

install.packages("remotes")
remotes::install_github("jozefhajnala/languageserversetup")
install.packages("languageserver")

However, when I tried installing again, it threw the error below

R version 4.1.3 (2022-03-10) -- "One Push-Up"
       Copyright (C) 2022 The R Foundation for Statistical Computing
       Platform: x86_64-pc-linux-gnu (64-bit)

       R is free software and comes with ABSOLUTELY NO WARRANTY.
       You are welcome to redistribute it under certain conditions.
       Type 'license()' or 'licence()' for distribution details.

         Natural language support but running in an English locale

       R is a collaborative project with many contributors.
       Type 'contributors()' for more information and
       'citation()' on how to cite R or R packages in publications.

       Type 'demo()' for some demos, 'help()' for on-line help, or
       'help.start()' for an HTML browser interface to help.
       Type 'q()' to quit R.

       > options(langserver_library = "/home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp");
       > options(repos = list(CRAN = "http://cran.rstudio.com/"));
       > rlsLib <- getOption("langserver_library");
       > 
       > didInstallRemotes <- FALSE;
       > tryCatch(
       +   expr = { library("remotes") },
       +   error = function (e) {
       +     install.packages("remotes", lib = rlsLib);
       +     loadNamespace("remotes", lib.loc = rlsLib);
       +     didInstallRemotes <- TRUE;
       +   }
       + );
       > 
       > remotes::install_github("jozefhajnala/languageserversetup", lib = rlsLib);
       Skipping install of 'languageserversetup' from a github remote, the SHA1 (3daf44a7) has not changed since last install.
         Use `force = TRUE` to force installation
       Error in loadNamespace("languageserversetup", lib.loc = rlsLib) : 
         there is no package called ‘languageserversetup’
       Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
       Execution halted
       > 
       > if (didInstallRemotes) {
       +     remove.packages("remotes", lib = rlsLib);
       + }
       > 
       > loadNamespace("languageserversetup", lib.loc = rlsLib);
       spawn: R failed with exit code 1. 

I asked the question in this thread too where they suggested that I should clear the lines added in Rprofile but that did not help too.

What are the steps needed to fix this?

Expected behavior

I expect the installer to work and install the language server.

LspInstallInfo output

Installed servers (6) 
    ◍ bashls 
    ◍ cssls 
    ◍ dockerls 
    ◍ html 
    ◍ jsonls 
    ◍ pyright (python)

  Available servers (109) 
    ◍ angularls 
    ◍ ansiblels 
    ◍ arduino_language_server 
    ◍ asm_lsp (assembly-gas, assembly-nasm, assembly-go)
    ◍ awk_ls 
    ◍ beancount 
    ◍ bicep 
    ◍ bsl_ls (onescript)
    ◍ ccls (c, c++, objective-c)
    ◍ clangd (c, c++)
    ◍ clarity_lsp 
    ◍ clojure_lsp 
    ◍ cmake 
    ◍ codeqlls 
    ◍ crystalline 
    ◍ csharp_ls (c#)
    ◍ cssmodules_ls 
    ◍ cucumber_language_server 
    ◍ dartls 
    ◍ denols 
    ◍ dhall_lsp_server 
    ◍ diagnosticls 
    ◍ dotls 
    ◍ efm 
    ◍ elixirls 
    ◍ elmls 
    ◍ ember 
    ◍ emmet_ls 
    ◍ erlangls 
    ◍ esbonio (sphinx)
    ◍ eslint (javascript, typescript)
    ◍ flux_lsp 
    ◍ foam_ls (OpenFOAM)
    ◍ fortls (fortran)
    ◍ fsautocomplete (f#)
    ◍ golangci_lint_ls (go)
    ◍ gopls (go)
    ◍ grammarly 
    ◍ graphql 
    ◍ groovyls 
    ◍ haxe_language_server 
    ◍ hls (haskell)
    ◍ intelephense (php)
    ◍ jdtls (java)
    ◍ jedi_language_server (python)
    ◍ jsonnet_ls 
    ◍ julials 
    ◍ kotlin_language_server 
    ◍ lelwel_ls 
    ◍ lemminx (xml)
    ◍ ltex (latex)
    ◍ mm0_ls (metamath-zero)
    ◍ nickel_ls 
    ◍ nimls 
    ◍ ocamlls deprecated 
    ◍ ocamllsp 
    ◍ omnisharp (c#)
    ◍ opencl_ls 
    ◍ perlnavigator 
    ◍ phpactor 
    ◍ powershell_es 
    ◍ prismals 
    ◍ prosemd_lsp (markdown)
    ◍ psalm (php)
    ◍ puppet 
    ◍ purescriptls 
    ◍ pylsp (python)
    ◍ quick_lint_js (javascript)
    ◍ r_language_server (R)
    ◍ reason_ls 
    ◍ remark_ls (markdown)
    ◍ rescriptls 
    ◍ rnix 
    ◍ rome (typescript, javascript)
    ◍ rust_analyzer 
    ◍ salt_ls (sls)
    ◍ scry (crystal)
    ◍ serve_d (d)
    ◍ slint_lsp 
    ◍ solang (solidity)
    ◍ solargraph (ruby)
    ◍ solc (solidity)
    ◍ solidity_ls 
    ◍ sorbet (ruby)
    ◍ sourcekit (swift)
    ◍ sourcery (python)
    ◍ spectral (openapi, asyncapi)
    ◍ sqlls 
    ◍ sqls 
    ◍ stylelint_lsp 
    ◍ sumneko_lua (lua)
    ◍ svelte 
    ◍ svls (systemverilog)
    ◍ tailwindcss 
    ◍ taplo (toml)
    ◍ terraformls 
    ◍ texlab (latex)
    ◍ tflint (terraform)
    ◍ theme_check (liquid)
    ◍ tsserver (typescript, javascript)
    ◍ vala_ls 
    ◍ verible (systemverilog, verilog)
    ◍ vimls 
    ◍ volar (vue)
    ◍ vuels 
    ◍ yamlls 
    ◍ zeta_note (markdown)
    ◍ zk (markdown)
    ◍ zls (zig)

Installation log

[INFO  Sat 16 Apr 2022 04:47:25 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 04:47:32 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 04:47:32 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 04:48:44 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 04:48:50 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 04:48:50 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 04:50:48 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="pyright", requested_version=""
[INFO  Sat 16 Apr 2022 04:50:51 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="pyright", success=true
[INFO  Sat 16 Apr 2022 04:52:44 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 04:52:50 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 04:52:50 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 04:57:09 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 04:57:10 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 04:57:10 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 05:01:08 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 05:01:08 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 05:01:08 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 05:01:57 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="dockerls", requested_version=""
[INFO  Sat 16 Apr 2022 05:02:04 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="dockerls", success=true
[INFO  Sat 16 Apr 2022 05:02:29 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 05:02:30 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 05:02:30 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 05:11:14 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 05:11:15 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 05:11:15 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 05:27:21 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 05:27:21 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 05:27:21 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false
[INFO  Sat 16 Apr 2022 05:27:34 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="bashls", requested_version=""
[INFO  Sat 16 Apr 2022 05:27:45 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="bashls", success=true
[INFO  Sat 16 Apr 2022 05:28:07 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="cssls", requested_version=""
[INFO  Sat 16 Apr 2022 05:28:13 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="cssls", success=true
[INFO  Sat 16 Apr 2022 05:28:43 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="html", requested_version=""
[INFO  Sat 16 Apr 2022 05:28:46 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="html", success=true
[INFO  Sat 16 Apr 2022 05:29:30 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="jsonls", requested_version=""
[INFO  Sat 16 Apr 2022 05:29:33 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="jsonls", success=true
[INFO  Sat 16 Apr 2022 05:36:12 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="r_language_server", requested_version=""
[ERROR Sat 16 Apr 2022 05:36:12 PM +03] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="r_language_server", error="spawn: R failed with exit code 1. "
[INFO  Sat 16 Apr 2022 05:36:12 PM +03] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="r_language_server", success=false

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **sh**: `Ok`
  - OK: **bash**: `GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.30`
  - OK: **gzip**: `gzip 1.10`
  - OK: **python3**: `Python 3.8.8`
  - ERROR: **node**: unsupported version `v10.19.0`. Node version must be >= 14
  - OK: **wget**: `GNU Wget 1.20.3 built on linux-gnu.`
  - OK: **Ruby**: `ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]`
  - ERROR: **Go**: unsupported version `go version go1.13.8 linux/amd64`. Go version must be >= 1.17.
  - OK: **curl**: `curl 7.71.1 (x86_64-conda_cos6-linux-gnu) libcurl/7.71.1 OpenSSL/1.1.1k zlib/1.2.11 libssh2/1.9.0`
  - OK: **java**: `Ok`
  - OK: **RubyGem**: `3.1.2`
  - OK: **javac**: `javac 11.0.14.1`
  - OK: **pip3**: `pip 21.0.1 from /home/kryekuzhinieri/anaconda3/lib/python3.8/site-packages/pip (python 3.8)`
  - OK: **npm**: `6.14.4`

Screenshots

No response

williamboman commented 2 years ago

Hello! What does the following return?

remotes::install_github("r-lib/pkgbuild")
pkgbuild::check_build_tools(debug = TRUE)
mouroutzoglou commented 2 years ago

Hello, I have a very similar experience with the original poster. For me, I get the following output from the above snippet: Your system is ready to build packages!

Working on an Intel MacBook Pro (2019 model, Big Sur)

KryeKuzhinieri commented 2 years ago

Hello! What does the following return?

remotes::install_github("r-lib/pkgbuild")
pkgbuild::check_build_tools(debug = TRUE)

The package got installed and returned Your system is ready to build packages!

williamboman commented 2 years ago

Thanks! And when you tried installing packages manually, did it work or did you run into any errors? What does the following yield?

install.packages("languageserver")
KryeKuzhinieri commented 2 years ago

It installs the package. Here are the logs

> install.packages("languageserver")
Installing package into ‘/home/kryekuzhinieri/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/languageserver_0.3.12.tar.gz'
Content type 'application/x-gzip' length 78124 bytes (76 KB)
==================================================
downloaded 76 KB

* installing *source* package ‘languageserver’ ...
** package ‘languageserver’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c fsm.c -o fsm.o
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c languageserver.c -o languageserver.o
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c reader.c -o reader.o
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c search.c -o search.o
gcc -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-lENDSu/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c stack.c -o stack.o
gcc -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o languageserver.so fsm.o languageserver.o reader.o search.o stack.o -L/usr/lib/R/lib -lR
installing to /home/kryekuzhinieri/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-languageserver/00new/languageserver/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (languageserver)

The downloaded source packages are in
    ‘/tmp/RtmpEvzxrt/downloaded_packages’
williamboman commented 2 years ago

Could you try installing the server using the branch fix-r_lang-install?

KryeKuzhinieri commented 2 years ago

I am not sure if I am doing this correctly. But these are the steps I followed:

 -- LSP manager
  {
    "williamboman/nvim-lsp-installer",
    module = "nvim-lsp-installer",
    branch = 'fix-r_lang-install',
    cmd = {
      "LspInstall",
      "LspInstallInfo",
      "LspPrintInstalled",
      "LspRestart",
      "LspStart",
      "LspStop",
      "LspUninstall",
      "LspUninstallAll",
    },
  },

Then I run

nvim +PackerSync

Finally, I tried installing the language server but it returned

r_language_server (failed)

        R version 4.1.3 (2022-03-10) -- "One Push-Up"
        Copyright (C) 2022 The R Foundation for Statistical Computing
        Platform: x86_64-pc-linux-gnu (64-bit)

        R is free software and comes with ABSOLUTELY NO WARRANTY.
        You are welcome to redistribute it under certain conditions.
        Type 'license()' or 'licence()' for distribution details.

          Natural language support but running in an English locale

        R is a collaborative project with many contributors.
        Type 'contributors()' for more information and
        'citation()' on how to cite R or R packages in publications.

        Type 'demo()' for some demos, 'help()' for on-line help, or
        'help.start()' for an HTML browser interface to help.
        Type 'q()' to quit R.

        > options(langserver_library = "/home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp");
        > options(repos = list(CRAN = "http://cran.rstudio.com/"));
        > rlsLib <- getOption("langserver_library");
        > 
        > didInstallRemotes <- FALSE;
        > tryCatch(
        +   expr = { library("remotes") },
        +   error = function (e) {
        +     install.packages("remotes", lib = rlsLib);
        +     loadNamespace("remotes", lib.loc = rlsLib);
        +     didInstallRemotes <- TRUE;
        +   }
        + );
        > 
        > # We set force = TRUE because this command will error if languageserversetup is already installed (even if it's at a
        > # different library location).
        > remotes::install_github("jozefhajnala/languageserversetup", lib = rlsLib, force = TRUE);
        Downloading GitHub repo jozefhajnala/languageserversetup@HEAD
        * checking for file ‘/tmp/RtmpDlndFa/remotesfcb81fa1db60/jozefhajnala-languageserversetup-3daf44a/DESCRIPTION’ ... OK
        * preparing ‘languageserversetup’:
        * checking DESCRIPTION meta-information ... OK
        * checking for LF line-endings in source and make files and shell scripts
        * checking for empty or unneeded directories
        Omitted ‘LazyData’ from DESCRIPTION
        * building ‘languageserversetup_0.1.2.900.tar.gz’

        * installing *source* package ‘languageserversetup’ ...
        ** using staged installation
        ** R
        ** inst
        ** byte-compile and prepare package for lazy loading
        ** help
        *** installing help indices
        ** building package indices
        ** testing if installed package can be loaded from temporary location
        ** testing if installed package can be loaded from final location
        ** testing if installed package keeps a record of temporary installation path
        * DONE (languageserversetup)
        > 
        > if (didInstallRemotes) {
        +     remove.packages("remotes", lib = rlsLib);
        + }
        > 
        > loadNamespace("languageserversetup", lib.loc = rlsLib);
        <environment: namespace:languageserversetup>
        > languageserversetup::languageserver_install(
        +     fullReinstall = TRUE,
        +     confirmBeforeInstall = FALSE,
        +     strictLibrary = TRUE
        + );
        trying URL 'http://cran.rstudio.com/src/contrib/remotes_2.4.2.tar.gz'
        Content type 'application/x-gzip' length 152540 bytes (148 KB)
        ==================================================
        downloaded 148 KB

        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error in tools:::.install_packages() : 
          current working directory cannot be ascertained
        sh: 0: getcwd() failed: No such file or directory

        The downloaded source packages are in
            ‘/tmp/RtmpDlndFa/downloaded_packages’
        Downloading GitHub repo REditorSupport/languageserver@master
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error: Failed to install 'languageserver' from GitHub:
          Could not find tools necessary to compile a package
        Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
        In addition: Warning message:
        In utils::install.packages("remotes", lib = rlsLib) :
          installation of package ‘remotes’ had non-zero exit status
        Execution halted
        spawn: R failed with exit code 1. 

Am I installing the branch correctly? Or the branch is not being picked up?

williamboman commented 2 years ago

It seems like it checked out the branch correctly (however I usually just go to the git clone location directly and manually check out the revision I want to test)!

Hmm.. I'm really not an R dev so I'm grasping at straws here. What catches my attention is the following:

        Error: Failed to install 'languageserver' from GitHub:
          Could not find tools necessary to compile a package
        In addition: Warning message:
        In utils::install.packages("remotes", lib = rlsLib) :
          installation of package ‘remotes’ had non-zero exit status

Seeing as we've ruled out the lack of compiler tools being the issue, what about installing the remotes package? Could you try

install.packages("remotes", lib=system("mktemp -d", intern=TRUE))
KryeKuzhinieri commented 2 years ago

So, I went through the R code in the r_language_server/init.lua file and tried setting options(langserver_library = "/home/kryekuzhinieri/Desktop/test"); and it worked. I also removed all occurrences of the rlsLib in the code and it worked again. Moreover, I went ahead and printed the path nvim was giving to the create_install_script function which returned

"/home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp"

I am not exactly sure but I think the issue here could be the path which is passed to the function because other cases seem to work just fine. Specifically,

create_install_script(ctx.cwd:get())

KryeKuzhinieri commented 2 years ago

install.packages("remotes", lib=system("mktemp -d", intern=TRUE))

Works fine. It installs the package successfully.

williamboman commented 2 years ago

Ah ok I think I know what it is now. We provide fullReinstall = TRUE, which causes languageserversetup to recursively unlink the rlsLib path. Without assuming too much, I believe this is actually fine on certain OSs/filesystems, on others (yours for example) it will cause the process to be unable to resolve its working directory (even if the very same directory is immediately recreated). There's a few traces of this already in your logs (a bunch of sh: 0: getcwd() failed: No such file or directory entries). Could you try pulling the latest commit from the branch and try installing again?

joelgsponer commented 2 years ago

Fantastic timing :-) just encountered the same error. After checking out the new branch it still fails, but with a somewhat different error message: `

loadNamespace("languageserversetup", lib.loc = rlsLib);

languageserversetup::languageserver_install( + confirmBeforeInstall = FALSE, + strictLibrary = TRUE + ); shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory trying URL 'http://cran.rstudio.com/bin/macosx/contrib/4.1/remotes_2.4.2.tgz' Content type 'application/x-gzip' length 395393 bytes (386 KB) ================================================== downloaded 386 KB
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    Error in setwd(cDir) : character argument expected
    Calls: <Anonymous> ... <Anonymous> -> .install.macbinary -> unpackPkg -> setwd
    Error in setwd(cDir) : character argument expected
    Calls: <Anonymous> ... <Anonymous> -> .install.macbinary -> unpackPkg -> setwd
    Execution halted
    spawn: R failed with exit code 1. 

`

KryeKuzhinieri commented 2 years ago

No, it still does not work for me. What is the need for setting a specific path for the language server? Is rlsLib needed in this case?

 Pending servers (1) 
    ◍ r_language_server (failed)

        R version 4.1.3 (2022-03-10) -- "One Push-Up"
        Copyright (C) 2022 The R Foundation for Statistical Computing
        Platform: x86_64-pc-linux-gnu (64-bit)

        R is free software and comes with ABSOLUTELY NO WARRANTY.
        You are welcome to redistribute it under certain conditions.
        Type 'license()' or 'licence()' for distribution details.

          Natural language support but running in an English locale

        R is a collaborative project with many contributors.
        Type 'contributors()' for more information and
        'citation()' on how to cite R or R packages in publications.

        Type 'demo()' for some demos, 'help()' for on-line help, or
        'help.start()' for an HTML browser interface to help.
        Type 'q()' to quit R.

        > options(langserver_library = "/home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp");
        > options(repos = list(CRAN = "http://cran.rstudio.com/"));
        > rlsLib <- getOption("langserver_library");
        > 
        > didInstallRemotes <- FALSE;
        > tryCatch(
        +   expr = { library("remotes") },
        +   error = function (e) {
        +     install.packages("remotes", lib = rlsLib);
        +     loadNamespace("remotes", lib.loc = rlsLib);
        +     didInstallRemotes <- TRUE;
        +   }
        + );
        > 
        > # We set force = TRUE because this command will error if languageserversetup is already installed (even if it's at a
        > # different library location).
        > remotes::install_github("jozefhajnala/languageserversetup", lib = rlsLib, force = TRUE);
        Downloading GitHub repo jozefhajnala/languageserversetup@HEAD
        * checking for file ‘/tmp/RtmpVIvWcp/remotes2b5cc78f1dbf8/jozefhajnala-languageserversetup-3daf44a/DESCRIPTION’ ... OK
        * preparing ‘languageserversetup’:
        * checking DESCRIPTION meta-information ... OK
        * checking for LF line-endings in source and make files and shell scripts
        * checking for empty or unneeded directories
        Omitted ‘LazyData’ from DESCRIPTION
        * building ‘languageserversetup_0.1.2.900.tar.gz’

        * installing *source* package ‘languageserversetup’ ...
        ** using staged installation
        ** R
        ** inst
        ** byte-compile and prepare package for lazy loading
        ** help
        *** installing help indices
        ** building package indices
        ** testing if installed package can be loaded from temporary location
        ** testing if installed package can be loaded from final location
        ** testing if installed package keeps a record of temporary installation path
        * DONE (languageserversetup)
        > 
        > if (didInstallRemotes) {
        +     remove.packages("remotes", lib = rlsLib);
        + }
        > 
        > loadNamespace("languageserversetup", lib.loc = rlsLib);
        <environment: namespace:languageserversetup>
        > languageserversetup::languageserver_install(
        +     confirmBeforeInstall = FALSE,
        +     strictLibrary = TRUE
        + );
        trying URL 'http://cran.rstudio.com/src/contrib/remotes_2.4.2.tar.gz'
        Content type 'application/x-gzip' length 152540 bytes (148 KB)
        ==================================================
        downloaded 148 KB

        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error in tools:::.install_packages() : 
          current working directory cannot be ascertained
        sh: 0: getcwd() failed: No such file or directory

        The downloaded source packages are in
            ‘/tmp/RtmpVIvWcp/downloaded_packages’
        Downloading GitHub repo REditorSupport/languageserver@master
        sh: 0: getcwd() failed: No such file or directory
        sh: 0: getcwd() failed: No such file or directory
        Error: Failed to install 'languageserver' from GitHub:
          Could not find tools necessary to compile a package
        Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
        In addition: Warning message:
        In utils::install.packages("remotes", lib = rlsLib) :
          installation of package ‘remotes’ had non-zero exit status
        Execution halted
        spawn: R failed with exit code 1. 
williamboman commented 2 years ago

Ugh.. The logs are missing a lot of details, I found an option to enable logging and pushed a new commit, would you mind running it once more and provide the logs 🙏?

What is the need for setting a specific path for the language server? Is rlsLib needed in this case?

It's to make sure it's installed in an isolated manner in a specific directory. Otherwise the package management is entirely delegated to R, at which point it'd not be a good fit for this plugin to support (also, from what I've read R's package management is somewhat "magic" and has a tendency to break installed packages over time by normalizing dep structures too much).

joelgsponer commented 2 years ago

Changing the following makes it work for me languageserversetup::languageserver_install( confirmBeforeInstall = FALSE, strictLibrary = FALSE, fullReinstall = FALSE ); I suspect a problem with the languagserversetup function.

KryeKuzhinieri commented 2 years ago

Ugh.. The logs are missing a lot of details, I found an option to enable logging and pushed a new commit, would you mind running it once more and provide the logs pray?

◍ r_language_server (failed)

    R version 4.1.3 (2022-03-10) -- "One Push-Up"
    Copyright (C) 2022 The R Foundation for Statistical Computing
    Platform: x86_64-pc-linux-gnu (64-bit)

    R is free software and comes with ABSOLUTELY NO WARRANTY.
    You are welcome to redistribute it under certain conditions.
    Type 'license()' or 'licence()' for distribution details.

      Natural language support but running in an English locale

    R is a collaborative project with many contributors.
    Type 'contributors()' for more information and
    'citation()' on how to cite R or R packages in publications.

    Type 'demo()' for some demos, 'help()' for on-line help, or
    'help.start()' for an HTML browser interface to help.
    Type 'q()' to quit R.

    > options(langserver_library = "/home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp");
    > options(langserver_quiet = FALSE);
    > options(repos = list(CRAN = "http://cran.rstudio.com/"));
    > rlsLib <- getOption("langserver_library");
    > 
    > didInstallRemotes <- FALSE;
    > tryCatch(
    +   expr = { library("remotes") },
    +   error = function (e) {
    +     install.packages("remotes", lib = rlsLib);
    +     loadNamespace("remotes", lib.loc = rlsLib);
    +     didInstallRemotes <- TRUE;
    +   }
    + );
    > 
    > # We set force = TRUE because this command will error if languageserversetup is already installed (even if it's at a
    > # different library location).
    > remotes::install_github("jozefhajnala/languageserversetup", lib = rlsLib, force = TRUE);
    Downloading GitHub repo jozefhajnala/languageserversetup@HEAD
    * checking for file ‘/tmp/Rtmp0P78cx/remotes2c94867cb012f/jozefhajnala-languageserversetup-3daf44a/DESCRIPTION’ ... OK
    * preparing ‘languageserversetup’:
    * checking DESCRIPTION meta-information ... OK
    * checking for LF line-endings in source and make files and shell scripts
    * checking for empty or unneeded directories
    Omitted ‘LazyData’ from DESCRIPTION
    * building ‘languageserversetup_0.1.2.900.tar.gz’

    * installing *source* package ‘languageserversetup’ ...
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
    * DONE (languageserversetup)
    > 
    > if (didInstallRemotes) {
    +     remove.packages("remotes", lib = rlsLib);
    + }
    > 
    > loadNamespace("languageserversetup", lib.loc = rlsLib);
    Keeping option: ‘langserver_library’ value: /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp
    Setting option: ‘langserver_processPatt’ to: languageserver::run
    Keeping option: ‘langserver_quiet’ value: FALSE
    Setting option: ‘langserver_quiet_serverproc’ to: FALSE
    Setting option: ‘langserver_rprofile_candidates’ to: /home/kryekuzhinieri/.Rprofile
    <environment: namespace:languageserversetup>
    > languageserversetup::languageserver_install(
    +     confirmBeforeInstall = FALSE,
    +     strictLibrary = TRUE,
    +     fromGitHub = TRUE
    + );
    system_dep_available not found, determining
        sysname is linux, pid is: 182600
        get_docall_args: class(pid)=linux, pid=182600
        setting get_docall_args: system2, list(command = "ps", args = c("-p", "182600", "-o", "command", "--no-headers"), stdout = FALSE)
    system_dep_available determined: TRUE
    langserver_install Starting
    determined new .lib.loc: /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp, /usr/lib/R/library
    fullReinstall is TRUE, deleting /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp
    rlsLib does not exist, creating /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp
    assigning /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp/usr/lib/R/library to .lib.loc
    running dev installation
    installing remotes into: /home/kryekuzhinieri/.local/share/nvim/lsp_servers/r_language_server.tmp
    trying URL 'http://cran.rstudio.com/src/contrib/remotes_2.4.2.tar.gz'
    Content type 'application/x-gzip' length 152540 bytes (148 KB)
    ==================================================
    downloaded 148 KB

    sh: 0: getcwd() failed: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    Error in tools:::.install_packages() : 
      current working directory cannot be ascertained
    sh: 0: getcwd() failed: No such file or directory

    The downloaded source packages are in
        ‘/tmp/Rtmp0P78cx/downloaded_packages’
    arguments to remotes::install_github: REditorSupport/languageserver, master, never, 1
    calling remotes::install_github to install languageserver
    Downloading GitHub repo REditorSupport/languageserver@master
    sh: 0: getcwd() failed: No such file or directory
    sh: 0: getcwd() failed: No such file or directory
    Error: Failed to install 'languageserver' from GitHub:
      Could not find tools necessary to compile a package
    Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
    In addition: Warning message:
    In utils::install.packages("remotes", lib = rlsLib) :
      installation of package ‘remotes’ had non-zero exit status
    langserver_install Exiting
    Execution halted
    spawn: R failed with exit code 1. 
KryeKuzhinieri commented 2 years ago

Changing the following makes it work for me languageserversetup::languageserver_install( confirmBeforeInstall = FALSE, strictLibrary = FALSE, fullReinstall = FALSE ); I suspect a problem with the languagserversetup function.

This works for me too.

williamboman commented 2 years ago

Ah, I didn't realize fullReinstall defaulted to TRUE 🙈 . Simply removing the arg did nothing.

I pushed another commit that explicitly sets fullReinstall = FALSE, let's see if that does it?

KryeKuzhinieri commented 2 years ago

Yeah, that did it. Thanks a lot @williamboman @joelgsponer

williamboman commented 2 years ago

Cool! Will merge #613 then. Thanks for the assistance, remote debugging can be a bit tedious haha