Automated, cross-platform setup for VSCode with R and Python development environments. Install VSCode, R, Python, and all necessary extensions and configurations with a single command.
- Unattended Installation: One-command setup for complete R and Python development environment
- Cross-Platform: Works on Linux, macOS, and Windows
- Architecture Agnostic: Supports x86_64 (amd64) and ARM64 architectures
- Binary Package Management: Fast R package installation without compilation
- PPM (Posit Public Package Manager): Default, works on all Linux distributions
- r2u + bspm: Ubuntu-specific, uses APT for R packages
- Complete VSCode Integration:
- R and Python extensions
- Jupyter support
- Shiny app support with play button execution
- Interactive plot viewers (httpgd for R, matplotlib for Python)
- Debug tools and language servers
- Optimized keybindings
- Enhanced Terminals: Optional radian for improved R console
Install Everything (R + Python + VSCode):
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bashR Only:
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bash -s -- --r-onlyPython Only:
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bash -s -- --python-onlyWith r2u (Ubuntu only):
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bash -s -- --package-manager=r2uConfigure Existing Installation (already have VSCode/R/Python installed):
# The script automatically detects existing installations and skips them
# It will still configure VSCode settings, extensions, and keybindings
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bashPowerShell (Run as Administrator):
irm https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.ps1 | iexWith Options:
irm https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.ps1 -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1 -ROnly
# or
powershell -ExecutionPolicy Bypass -File .\install.ps1 -PythonOnlyNote: If you get an error like "running scripts is disabled on this system", see Troubleshooting → PowerShell Execution Policy.
For WSL users: Install VSCode on Windows first, then run the Linux script from your WSL terminal:
# 1. Install VSCode on Windows: https://code.visualstudio.com/
# 2. Install the "Remote - WSL" extension in VSCode
# 3. Run this from your WSL terminal:
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bashThe script automatically detects WSL and guides you through the setup. See Troubleshooting → Running in WSL for details.
This repository supports Google Antigravity (the new AI-first IDE based on VS Code).
Prerequisites:
- Install Google Antigravity manually.
- Ensure you can run the
antigravitycommand from your terminal (add it to your PATH if necessary).
These scripts will install R/Python/Radian (if missing) and configure Antigravity to use the official Microsoft Marketplace (instead of OpenVSX) so that standard Python and R extensions work correctly.
Windows (PowerShell as Administrator):
irm https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/setup_antigravity.ps1 | iexNote: If you get an execution policy error, see Troubleshooting → PowerShell Execution Policy.
Linux/macOS (Bash):
curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/setup_antigravity.sh | bashNote: These scripts do not modify keybindings in Antigravity.
./install.sh [OPTIONS]
Options:
--r-only Install only R and R tools
--python-only Install only Python and Python tools
--package-manager Choose R package manager: 'ppm' (default) or 'r2u' (Ubuntu only)
--skip-vscode Skip VSCode installation (configure existing installation)
--skip-radian Skip radian installation (use default R console)
--non-interactive Run without prompts (use defaults)
-h, --help Show this help message.\install.ps1 [-ROnly] [-PythonOnly] [-SkipVSCode] [-SkipRadian] [-NonInteractive] [-Help]
Parameters:
-ROnly Install only R and R tools
-PythonOnly Install only Python and Python tools
-SkipVSCode Skip VSCode installation
-SkipRadian Skip radian installation
-NonInteractive Run without prompts
-Help Show help message- R (latest version from CRAN)
- VSCode Extensions:
REditorSupport.r- R language supportRDebugger.r-debugger- R debuggingPosit.shiny- Shiny app support with play button
- R Packages:
languageserver- Code intelligencehttpgd- Interactive plot viewer in VSCodeshiny- Web application frameworkshinyWidgets- Enhanced UI widgets for Shiny apps
- Radian (optional): Enhanced R console with syntax highlighting
- Watchdog (optional): File system monitoring for Shiny devmode autoreload
- Binary Package Manager:
- PPM (default): Works on all platforms
- r2u + bspm (Ubuntu): APT-based, faster on Ubuntu
- Python 3 (system package manager or Python.org)
- VSCode Extensions:
ms-python.python- Python language supportms-toolsai.jupyter- Jupyter notebook support
- Tools:
pip- Package installervenv- Virtual environment support
- Visual Studio Code (if not already installed)
- Configured Settings:
- R terminal and plot integration
- Python interpreter detection
- Optimized editor settings
- Keybindings:
- R:
Ctrl+Enter(run line/selection),Ctrl+Shift+Enter(run chunk) - Python:
Ctrl+Enter(run line/selection) - Shiny:
F5or play button to run app
- R:
The script automatically detects existing installations! If you already have VSCode, R, or Python installed:
✅ What the script does:
- Detects existing installations and skips reinstalling them
- Shows success messages for already-installed tools
- Still installs missing VSCode extensions (REditorSupport.r, Posit.shiny, ms-python.python, etc.)
- Still configures VSCode settings (httpgd plots, radian terminal, interpreter paths)
- Still sets up keybindings (Ctrl+Enter for R/Python execution)
Example scenarios:
| What You Have | What the Script Does |
|---|---|
| VSCode + R + Python installed, but not configured | Skips installation, configures everything |
| VSCode + R installed, need Python | Skips VSCode/R, installs Python, configures all |
| Everything installed, just need Shiny support | Skips installation, adds Posit.shiny extension + settings |
| Fresh system | Installs and configures everything |
Simply run the script - it will detect what you have and configure what's needed:
./install.sh- Open an
app.Rfile in VSCode - Click the Run button (play icon) in the top right
- Select "Run Shiny App" from the menu
- Or press F5
The app will launch and open in your default browser.
Plots automatically appear in the PLOTS panel in VSCode when using:
plot(1:10)
ggplot(data, aes(x, y)) + geom_point()For matplotlib plots to show in VSCode:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.show() # Opens in VSCode plot viewerFast binary packages for Linux, source for macOS/Windows:
install.packages("tidyverse") # Installs as binary on LinuxConfiguration is automatic. PPM repository is set in ~/.Rprofile or /etc/R/Rprofile.site.
Install R packages via APT (system package manager):
install.packages("tidyverse") # Uses apt-get behind the scenesOr directly with apt:
sudo apt install r-cran-tidyverseBenefits:
- Instant installation (no compilation)
- System-wide package management
- Shared dependencies with system packages
If you get an error like:
"File cannot be loaded because running scripts is disabled on this system"
This is due to PowerShell's default security policy. Here are your options:
Option 1: Use the one-liner (recommended)
The irm | iex command bypasses execution policy automatically:
irm https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.ps1 | iexOption 2: Bypass policy for a single script
If you need to run the downloaded script with options:
irm https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.ps1 -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1Option 3: Change policy for current user (persistent)
Allow scripts from the internet that are signed or from trusted sources:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThen run the script normally:
.\install.ps1Option 4: Unblock the downloaded file
Right-click the downloaded .ps1 file → Properties → Check "Unblock" → OK. Or use PowerShell:
Unblock-File -Path .\install.ps1
.\install.ps1-
Ensure Posit.shiny extension is installed:
code --install-extension Posit.shiny
-
Restart VSCode
-
Open
app.Rfile - the play button menu should show "Run Shiny App"
-
Verify httpgd is installed:
install.packages("httpgd") -
Check VSCode setting
r.plot.useHttpgdistrue:- Open Settings (Ctrl+,)
- Search for "r.plot.useHttpgd"
- Ensure it's checked
-
Restart R terminal in VSCode
- Reload VSCode window:
Ctrl+Shift+P→ "Developer: Reload Window" - Verify Python extension is installed
- Open a
.pyfile - the play button should appear
Ensure ~/.local/bin is in your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcThe script automatically detects WSL! Here's how it works:
-
VSCode Installation:
- Install VSCode on Windows (not in WSL): https://code.visualstudio.com/
- Install the Remote - WSL extension in VSCode
- The
codecommand will automatically be available in WSL
-
Running the Script:
# Run from your WSL terminal (Ubuntu, Debian, etc.) curl -fsSL https://raw.githubusercontent.com/Fr4nzz/Setup-R-and-python-on-VSCode/main/install.sh | bash
-
What Happens:
- If
codeis found (VSCode already set up): Script configures everything ✅ - If
codeis NOT found: Script provides setup instructions and skips VSCode installation
- If
-
R and Python: Installed in WSL (Linux side), configured to work with Windows VSCode
Recommended WSL Setup:
- Install VSCode on Windows first
- Install Remote-WSL extension
- Open WSL terminal:
wslor use Windows Terminal - Run the installation script
- Open your project:
code .from WSL terminal
If you prefer not to use the automated scripts, see MANUAL_INSTALL.md for step-by-step instructions.
- Linux: x86_64, ARM64 (aarch64)
- macOS: Intel (x86_64), Apple Silicon (ARM64)
- Windows: x86_64, ARM64
- Ubuntu/Debian: 20.04+ (recommended)
- Arch Linux/Manjaro: Latest
- Fedora/RHEL/CentOS: Recent versions
curlorwgetsudoaccess
- macOS 10.15 (Catalina) or later
- Command Line Tools for Xcode
- Windows 10 or later
- PowerShell 5.1 or later
- Administrator privileges
Contributions welcome! Please open an issue or pull request.
MIT License - see LICENSE for details.
Based on scripts from Termux-Fr4nz for setting up VSCode with R and Python in containerized environments.