{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Kernel\n", "\n", "The issue seems to be that R is not found in your current PATH, which is necessary for running R from the terminal. This might be because R is not installed in the virtual environment or the path to the system-wide R installation is not included in your PATH.\n", "\n", "Here are the steps to resolve this:\n", "\n", "### Step 1: Ensure R is Installed and Accessible\n", "1. **Check if R is installed system-wide**:\n", " ```bash\n", " which R\n", " ```\n", " This should return the path to the R executable, such as `/usr/local/bin/R`. If it doesn’t, you may need to install R.\n", "\n", "2. **Install R** (if not already installed):\n", " - Download and install R from [CRAN](https://cran.r-project.org/mirrors.html).\n", "\n", "### Step 2: Add R to the PATH`\n", "1. **Find the path to the R executable**:\n", " ```bash\n", " which R\n", " ```\n", " Assume it returns `/usr/local/bin/R`.\n", "\n", "2. **Add the R path to your PATH environment variable**:\n", " ```bash\n", " export PATH=/usr/local/bin:$PATH`\n", " ```\n", "\n", "3. **Add the R path to your shell configuration file** (`~/.zshrc` if you are using zsh):\n", " ```bash\n", " echo 'export PATH=/usr/local/bin:$PATH' >> ~/.zshrc\n", " ```\n", "\n", "4. **Reload the shell configuration file**:\n", " ```bash\n", " source ~/.zshrc\n", " ```\n", "\n", "### Step 3: Register the IRKernel Again\n", "1. **Activate your virtual environment** (if not already active):\n", " ```bash\n", " source /Users/apollo/documents/athena/myenv/bin/activate\n", " ```\n", "\n", "2. **Ensure Jupyter is installed**:\n", " ```bash\n", " pip install jupyter jupyter-client\n", " ```\n", "\n", "3. **Open R from the terminal**:\n", " ```bash\n", " R\n", " ```\n", "\n", "4. **Run the IRKernel installation command**:\n", " ```R\n", " IRkernel::installspec(user = TRUE)\n", " ```\n", "\n", "### Verify Kernel Registration\n", "1. **Check available Jupyter kernels**:\n", " ```bash\n", " jupyter kernelspec list\n", " ```\n", "\n", "These steps should ensure that R is accessible from the terminal and allow you to properly register the IRKernel for use in Jupyter Notebooks within VSCode." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [ "hide-input" ], "vscode": { "languageId": "r" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[1] \"Hello, Jupyter!\"\n" ] }, { "data": { "text/html": [ "
x | y | |
---|---|---|
<dbl> | <dbl> | |
1 | -0.5371955 | -0.0541714 |
2 | -0.1065361 | -0.9117403 |
3 | -1.1484578 | 0.5542809 |
4 | 0.3696978 | 0.4301771 |
5 | 0.1404496 | -1.7273244 |
6 | 0.7060422 | -0.4229898 |