REditorSupport / languageserver

An implementation of the Language Server Protocol for R
Other
591 stars 93 forks source link

Installation issue #535

Open alexhallam opened 2 years ago

alexhallam commented 2 years ago

I am guessing there is something obvious I missed.

  1. I am on Ubuntu and installed the needed package
  2. I installed remotes::install_github("REditorSupport/languageserver" in R

When I ran :LspInstall r_server_language I got this:

    ◍ 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
eitsupi commented 2 years ago

Could this problem be from the languageserversetup package and not related to this repository?

KryeKuzhinieri commented 2 years ago

I am getting the same error. Any solution to this?

eitsupi commented 2 years ago

@KryeKuzhinieri What is your procedure for installation? Are you installing it the way it says in the README?

KryeKuzhinieri commented 2 years ago

I am on Ubuntu 20.04 and I tried :LspInstall r_server_language Then, I tried installing the packages directly to R and now it throws the following error

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. 
eitsupi commented 2 years ago

@KryeKuzhinieri Could you describe exactly what steps were taken? Perhaps it is a Neovim issue?

:LspInstall r_server_language

I think there is a problem with this command. (And I don't think it's defined in this repository)

KryeKuzhinieri commented 2 years ago

I recently installed neovim where I decided to use the Astro Vim configuration to make the transition from vim to nvim faster. Firstly I tried: :LspInstall r_server_language But it threw the error @alexhallam got. Then I installed the packages manually

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

But I got the error described above. Just to be sure that I have all the dependencies, I tried

apt install --assume-yes --no-install-recommends build-essential libcurl4-openssl-dev libssl-dev libxml2-dev r-base

But they were all there.

eitsupi commented 2 years ago

It seems likely that something was written to Rprofile file by :LspInstall r_server_language. Therefore, if you check the contents of the Rprofile and remove such processing, it may function properly.

I recommend opening a issue in the repository where :LspInstall r_server_language is defined, not here.

eitsupi commented 2 years ago

It looks like this repository. https://github.com/williamboman/nvim-lsp-installer/blob/5c223f21ff8b513e87ff9f002d5d133dffe729de/lua/nvim-lsp-installer/servers/r_language_server/init.lua

eitsupi commented 2 years ago

@KryeKuzhinieri I recommend opening an issue on https://github.com/williamboman/nvim-lsp-installer and linking from this issue.

KryeKuzhinieri commented 2 years ago

@eitsupi Thanks for your feedback. I raised the issue here https://github.com/williamboman/nvim-lsp-installer/issues/604

KryeKuzhinieri commented 2 years ago

Issue was resolved here https://github.com/williamboman/nvim-lsp-installer/issues/604