Jupyter Notebook中R内核启动失败求助:更新R与Jupyter Lab后报错
Hey there, let's get your R kernel working again in Jupyter Lab! The error you're seeing is super common after updating R via Homebrew—here's why and how to fix it:
What's Causing the Issue?
When you updated R with Homebrew, it replaced the old 3.5.3 version with a newer one. But your Jupyter R kernel (IRkernel) is still trying to point to the old R installation path (/usr/local/Cellar/r/3.5.3/lib/R/bin/R), which no longer exists. That's exactly why you're hitting the FileNotFoundError.
Step-by-Step Fix
Check your current R installation path
Open a terminal and run this command to locate your updated R:which RYou'll get an output like
/usr/local/bin/Ror/usr/local/Cellar/r/[new-version-number]/lib/R/bin/R—this is your active, working R path.Reinstall and reconfigure IRkernel
Launch R in your terminal (just typeRand hit enter), then run these commands to refresh the kernel's configuration:# Update IRkernel to the latest version install.packages('IRkernel') # Re-register the kernel with Jupyter (use user=FALSE for global access across all users) IRkernel::installspec(user = FALSE)This will overwrite the old kernel settings and point Jupyter directly to your new R installation.
Verify the fix
Close and restart Jupyter Lab, then try launching an R notebook again. The kernel should start up smoothly now!
Optional: Manual Cleanup (If Needed)
If the above steps don't resolve the issue immediately, you can manually tweak the kernel config file:
- Navigate to
~/Library/Jupyter/kernels/iron your Mac - Open the
kernel.jsonfile - Ensure the
argvfield points to the R path you found withwhich R - Save the file and restart Jupyter Lab
内容的提问来源于stack exchange,提问作者Ong K.S

