Replies: 1 comment 1 reply
-
I found this bug report that gave me a clue to follow. Although I made some progress with it, I'm still unable to solve the problem. Setting up the
|
Beta Was this translation helpful? Give feedback.
-
I found this bug report that gave me a clue to follow. Although I made some progress with it, I'm still unable to solve the problem. Setting up the
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Building a quarto website, I want my
index.qmd
file to include python code chunks. Specifically, I want to link this.qmd
file to a virtual environment of python. Furthermore, I wish to use python'svenv
thus avoidingreticulate
orconda
.The problem
Doing all the steps as I will describe below, I end up with quarto not recognizing python's venv, despite being in the same project folder. That is, running in Terminal the command:
# Terminal quarto check jupyter
I get
Steps to reproducing the problem
I have a clean
venv
setup that I adopted from this YouTube video.I'm installing this on a Windows machine
Install python 3
v 3.9.0
; 64-bit).C:\pyver\py390
PATH
. I want everything to be as "isolated" as possible.Create quarto website
RStudio -> File -> New Project -> New Directory -> Quarto Website

I give it a name:

my-qrt-website
Now I have a minimal setup for quarto website, and I want to add
python
code chunks. At this point, quarto can't detect any python installation:# Terminal quarto check
I get
I assume, but didn't confirm it, that quarto is unable to locate the python I installed earlier because I didn't add it to
PATH
. As far as I'm concerned, this is very good, because I do not want quarto to pick up whatever python installation it finds on my machine. Rather, I want this specific quarto website to link with a specific python version and a specific virtual environemnt (i.e., python modules of specific versions, etc.).This is why I found quarto's documentation about virtual environments very promising. Specifically, the piece that says:
Setting up virtual environment with
venv
In Terminal, navigate to quarto website directory
D:\local_quarto_website\my-qrt-website>
Create a virtual environment called
env
, while referring to the desired, specific, python version:After a couple of seconds, we can see that a new folder called

env
has been created:Activate the virtual environemnt
And command-line prompt changes to
(env) D:\local_quarto_website\my-qrt-website>
Within the now-activated virtual environment, install python modules
# Terminal pip install jupyter matplotlib pandas
Deactivate the virtual environment
# Terminal deactivate
Circle back to the problem
So now I have a quarto website directory with the following contents:
So why can't it recognize my python virtual environment, despite having this nice
env
directory as promised in the documnetation?Beta Was this translation helpful? Give feedback.
All reactions