quarto-dev / quarto-dev/quarto-cli
rendering attempts to write within virtual environment
Open
@cderv is already working on this.
Since Jan 11, 2024.
bug
python-setup
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
The quarto render attempts to render Markdown files contained within a virtual environment directory structure.
Steps to reproduce
Given a Dockerfile:
ARG QUARTO_VERSION=1.4.537
FROM ghcr.io/quarto-dev/quarto:$QUARTO_VERSION
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
curl \
&& \
rm -rf /var/lib/apt/lists/*
ARG PYTHON_VERSION=3.11.3
ARG OS_IDENTIFIER=ubuntu-2204
RUN curl -fsSL -O https://cdn.rstudio.com/python/${OS_IDENTIFIER}/pkgs/python-${PYTHON_VERSION}_1_amd64.deb && \
apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -f -y ./python-${PYTHON_VERSION}_1_amd64.deb && \
rm python-${PYTHON_VERSION}_1_amd64.deb && \
rm -rf /var/lib/apt/lists/*
RUN /opt/python/3.11.3/bin/python -m venv /venv && \
PIP_ROOT_USER_ACTION=ignore /venv/bin/pip install -U pip && \
PIP_ROOT_USER_ACTION=ignore /venv/bin/pip install jupyter
RUN useradd -m person
COPY index.qmd _quarto.yml /content/
RUN chown -R person:person /content/
# libsqlite3 is needed by IPython/core/history
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
sqlite3
USER person
WORKDIR /content
RUN mkdir /content/python && ln -s /venv python/env
RUN PATH=/content/python/env/bin:/opt/python/${PYTHON_VERSION}/bin:$PATH QUARTO_PYTHON=/content/python/env/bin/python JUPYTER_PATH=/content/python/env/share/jupyter quarto render
an index.qmd:
---
title: using python
---
```{python}
1+1
```
and a _quarto.yml:
project:
output-dir: output
Expected behavior
Only the index.qmd should be rendered.
Actual behavior
Files within the python/env virtual environment are identified and rendered. The python/env virtual environment is referenced by a symbolic link to the actual location of the virtual environment and that location is (intentionally) not writable to the running user.
Building an image:
docker build .
produces the error:
[2/6] python/env/lib/python3.11/site-packages/pyzmq-25.1.2.dist-info/AUTHORS.md
24.90 ERROR: PermissionDenied: Permission denied (os error 13): mkdir '/content/python/env/lib/python3.11/site-packages/pyzmq-25.1.2.dist-info/AUTHORS_files/mediabag'
24.90
24.90 Stack trace:
24.90 at Object.mkdirSync (ext:deno_fs/30_fs.js:132:7)
24.90 at ensureDirSync (file:///opt/quarto/bin/quarto.js:9286:14)
24.90 at renderPandoc (file:///opt/quarto/bin/quarto.js:69965:5)
24.90 at Object.onRender (file:///opt/quarto/bin/quarto.js:77197:42)
24.90 at renderFileInternal (file:///opt/quarto/bin/quarto.js:77174:38)
24.90 at eventLoopTick (ext:core/01_core.js:183:11)
24.90 at async renderFiles (file:///opt/quarto/bin/quarto.js:76998:17)
24.90 at async renderProject (file:///opt/quarto/bin/quarto.js:77325:25)
24.90 at async Command.fn (file:///opt/quarto/bin/quarto.js:81890:32)
24.90 at async Command.execute (file:///opt/quarto/bin/quarto.js:8102:13)
Your environment
No response
Quarto check output
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.