Rstudio defaulting to the Python kernel

270 Views Asked by At

I am having an issue with my Quarto website project. I always use the R kernel in rstudio on both of my computers, but when I reopened my project on my other computer, it seems to be defaulting to the Python kernel, causing the following error when I render for website:

Starting python3 kernel...Traceback (most recent call last): File "/Applications/RStudio.app/Contents/Resources/app/quarto/share/jupyter/jupyter.py", line 21, in <module> from notebook import notebook_execute, RestartKernel File "/Applications/RStudio.app/Contents/Resources/app/quarto/share/jupyter/notebook.py", line 17, in <module> import nbformat ModuleNotFoundError: No module named 'nbformat' Python 3 installation: Version: 3.11.2 Path: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 Jupyter: (None)

Jupyter is not available in this Python installation. Install with python3 -m pip install jupyter

I have tried some solutions, including:

  1. Adding the kernel:ir option to the top of the .quarto.yml file
  2. Restarting RStudio to make sure that changes to the .quarto.yml file are being picked up correctly
  3. Checking the project options in RStudio to make sure that the correct kernel is selected but I can't find the specific quarto options there or in the global options
  4. in the console or in the environment tab, it looks like R is being used.

Does anybody have any ideas on how to change it back to the r kernel when I render for websites?

thanks,

1

There are 1 best solutions below

0
neural_axon On

I hope this might help someone in the future who encounter the same problem. For me, this solution worked.

Essentially, put engine as knitr

E.g.:

---
title: "Example Document"
format:
  html:
    theme: 
      light: Journal
      dark: Darkly
    self-contained: true
    embed-resources: true
    code-fold: false
    toc: true
editor: source
engine: knitr
---