quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.54k stars 291 forks source link

Rendering qmd (button/command) suddenly leads to ModuleNotFoundError #1365

Open ifateri opened 1 year ago

ifateri commented 1 year ago

Bug description

Hello,

I've been working on a qmd file with Python only in VS Code (Windows 10.0.19044) for quite some time, but am suddenly running into ModuleNotFoundError errors when trying to render the qmd file (either via button or via terminal with quarto render file.qmd) despite no changes in my project folder.

I've noticed that pressing the render button starts either quarto render file.qmd or quarto preview file.qmd and I don't understand why this is or when to expect which command.

Strangely if I manually run quarto preview file.qmd via terminal it seems to fully render the report and after that I can use the render button and the manual render command?

Edit: it seems to be quite random as quarto preview can also lead to the error..?

quarto check Output

[>] Checking Quarto installation......OK
      Version: 1.0.11
      Path: C:\Users\rindrakusuma\AppData\Local\Programs\Quarto\bin\
      CodePage: unknown

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.10.4
      Path: C:/Users/rindrakusuma/scoop/apps/python/current/python.exe
      Jupyter: 4.10.0
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

quarto tools check Output

[>] Inspecting tools

Tool         Status            Installed     Latest  
chromium     Not installed     ---           869685  
tinytex      Up to date        v2022.07      v2022.07

Checklist

hopezh commented 1 year ago

I encountered a similar issue, and I solved it, or I think so, by

  1. creating and activating a new conda env,
  2. installing all the python packages used in the qmd file, and
  3. rendering the qmd file via quarto preview hello.qmd with the newly created conda env activated.

Hope this helps.

mcanouil commented 1 year ago

@ifateri Did you solve your problem? Do you still have the issue with Quarto 1.3?

@hopezh Are you suggesting/saying, the issue comes from the Python environment?

hopezh commented 1 year ago

@mcanouil I'm not sure if it's related to the specific "messy" Python environment I have. I just know that I'll have this problem if I use the base environment of conda even if it has all the modules installed.

mcanouil commented 1 year ago

Would you be able to give the steps to reproduce the issue?