oraios/serena · error · RuntimeError

R is not installed. Please install R from https://www.r-proj

Error message

R is not installed. Please install R from https://www.r-project.org/

What it means

The whole probe in `_check_r_installation()` is wrapped in `except FileNotFoundError`, which fires when the `R` executable itself cannot be spawned at all (the OS returns ENOENT, not a non-zero exit). The wrapper converts that into this RuntimeError pointing at the official R download page.

Source

Thrown at src/solidlsp/language_servers/r_language_server.py:55

            result = subprocess_run(["R", "--version"], capture_output=True, text=True, check=False)
            if result.returncode != 0:
                raise RuntimeError("R is not installed or not in PATH")

            # Check languageserver package
            result = subprocess_run(
                ["R", "--vanilla", "--quiet", "--slave", "-e", "if (!require('languageserver', quietly=TRUE)) quit(status=1)"],
                capture_output=True,
                text=True,
                check=False,
            )

            if result.returncode != 0:
                raise RuntimeError(
                    "R languageserver package is not installed.\nInstall it with: R -e \"install.packages('languageserver')\""
                )

        except FileNotFoundError:
            raise RuntimeError("R is not installed. Please install R from https://www.r-project.org/")

    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
        # Check R installation
        self._check_r_installation()

        # R command to start language server
        # Use --vanilla for minimal startup and --quiet to suppress all output except LSP
        # Set specific options to improve parsing stability
        r_cmd = 'R --vanilla --quiet --slave -e "options(languageserver.debug_mode = FALSE); languageserver::run()"'

        super().__init__(config, repository_root_path, ProcessLaunchInfo(cmd=r_cmd, cwd=repository_root_path), "r", solidlsp_settings)

    def _create_base_initialize_params(self) -> dict:
        """Initialize params for R Language Server."""
        initialize_params = {
            "locale": "en",
            "capabilities": {
                "textDocument": {

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install R: `apt install r-base` / `brew install r` / download from https://www.r-project.org/
  2. Add R's bin directory to PATH (e.g. `export PATH="$PATH:/usr/local/bin"` or the Rtools/R install dir on Windows) in the environment that launches the app
  3. Confirm with `command -v R && R --version` in the exact shell/container running the library before starting it

Example fix

# before (Dockerfile)
FROM python:3.11-slim
RUN pip install multilspy  # no R present

# after
FROM python:3.11-slim
RUN apt-get update && apt-get install -y r-base && R -e "install.packages('languageserver')"
RUN pip install multilspy
Defensive patterns

Strategy: validation

Validate before calling

import shutil
if shutil.which("R") is None:
    raise SystemExit("R not found on PATH; install from https://www.r-project.org/ and add its bin dir to PATH")

Type guard

def r_on_path() -> bool:
    return shutil.which("R") is not None

Try / catch

try:
    server = RLanguageServer(config, repo_root, settings)
except RuntimeError as e:
    if "www.r-project.org" in str(e):
        logger.error("R executable missing: %s", e)
        raise SystemExit(1) from e
    raise

Prevention

When it happens

Trigger: Instantiating the R language server on a machine where no `R` binary exists on PATH at all — R never installed, or the process environment's PATH lacks the directory containing `R`.

Common situations: Docker images or CI runners without R installed; macOS without Homebrew R and no command-line R; IDE/daemon launched with a sanitized PATH that omits /usr/local/bin or Homebrew paths; Windows install that didn't add R to PATH.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/f64972ff281c2eca. Report an issue: GitHub.