streamlit app is working fine on local machine but getting Error on streamlit cloud.
Through this app - after the user file upload and performing Analytics from this page on it I am trying to run quarto
document qmd
file using subprocess to generate downloadable html
report from this app page where the issue arises in generating report.
It’s hosted on streamlit cloud with streamlit link Github Repo link.
Doubt/Issue: In order to run quarto
document (Report-template.qmd
) that requires data processed in streamlit pages I am writing dataframe and a text file (which were processed in streamlit pages) to disk using below code:
ss.pl_df.write_csv(ss.file_name_csv)
with open(ss.ai_failed_file_name, 'w') as f:
f.write(ss.assistant_response)
this works fine when working in local environment widows 11 machine and even working here but it I am not sure where the files get written when on streamlit cloud/hosting.
I think these files that I am writing within streamlit cloud doesn’t go to github repo so the file location mapping is failing in cloud where as it was able to pickup file correctly from root directory when running in local machine.
What should be the location of the files that I am writing it in streamlit cloud to provide the correct path to the quarto document to use these files.
(I am aware it will be available only temporarily/ till session last and that is the purpose as well.)
I am not sure if this is the right cause of issue or something else but this seems to be the most logical possibility to me.
Error while running app:
```
────────────────────── Traceback (most recent call last) ───────────────────────
```
```
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
```
```
nner/exec_code.py:88 in exec_func_with_error_handling
```
```
/home/adminuser/venv/lib/python3.12/site-packages/streamlit/runtime/scriptru
```
```
nner/script_runner.py:590 in code_to_exec
```
```
/mount/src/healthquant/pages/6_AnalyticsReport_Download.py:109 in <module>
```
```
106 │ # st.write(ss.cmd_str)
```
```
107 │
```
```
108 │ # run Quarto Document using command through subprocess
```
```
❱ 109 │ subprocess.run(ss.cmd_str)
```
```
110 │
```
```
111 │ # result = subprocess.run(ss.cmd_str, capture_output=True)
```
```
112 │ # print(result)
```
```
/usr/local/lib/python3.12/subprocess.py:548 in run
```
```
545 │ │ kwargs['stdout'] = PIPE
```
```
546 │ │ kwargs['stderr'] = PIPE
```
```
547 │
```
```
❱ 548 │ with Popen(*popenargs, **kwargs) as process:
```
```
549 │ │ try:
```
```
550 │ │ │ stdout, stderr = process.communicate(input, timeout=timeo
```
```
551 │ │ except TimeoutExpired as exc:
```
```
/usr/local/lib/python3.12/subprocess.py:1026 in __init__
```
```
1023 │ │ │ │ │ self.stderr = io.TextIOWrapper(self.stderr,
```
```
1024 │ │ │ │ │ │ │ encoding=encoding, errors=errors)
```
```
1025 │ │ │
```
```
❱ 1026 │ │ │ self._execute_child(args, executable, preexec_fn, close_f
```
```
1027 │ │ │ │ │ │ │ │ pass_fds, cwd, env,
```
```
1028 │ │ │ │ │ │ │ │ startupinfo, creationflags, shell,
```
```
1029 │ │ │ │ │ │ │ │ p2cread, p2cwrite,
```
```
/usr/local/lib/python3.12/subprocess.py:1955 in _execute_child
```
```
1952 │ │ │ │ │ if errno_num != 0:
```
```
1953 │ │ │ │ │ │ err_msg = os.strerror(errno_num)
```
```
1954 │ │ │ │ │ if err_filename is not None:
```
```
❱ 1955 │ │ │ │ │ │ raise child_exception_type(errno_num, err_msg
```
```
1956 │ │ │ │ │ else:
```
```
1957 │ │ │ │ │ │ raise child_exception_type(errno_num, err_msg
```
```
1958 │ │ │ │ raise child_exception_type(err_msg)
```
```
────────────────────────────────────────────────────────────────────────────────
```
```
FileNotFoundError: [Errno 2] No such file or directory: 'quarto render
```
```
Report-template.qmd -P file_name:"df_65e5cd09-3f9a-4ec0-af4c-617699c674e7.csv"
-P user_name:"Mr. /Ms. xxx" --output
"Report-out-65e5cd09-3f9a-4ec0-af4c-617699c674e7.html"'
```
```
/mount/src/healthquant/utilities_v3.py:64: SyntaxWarning:
```
```
invalid escape sequence '\|'
```
```
/mount/src/healthquant/functions_parse.py:70: SyntaxWarning:
```
```
invalid escape sequence '\|'
```
```
/mount/src/healthquant/functions_parse_max.py:57: SyntaxWarning:
```
```
invalid escape sequence '\|'
```
Requirements.txt
streamlit==1.38.0
pandas==2.2.2
polars==1.6.0
streamlit_lottie==0.0.5
nest_asyncio==1.6.0
llama_parse==0.5.0
fuzzywuzzy==0.18.0
plotly==5.24.1
streamlit_option_menu==0.3.13
pdftotext==2.2.2
groq==0.11.0
httpx==0.27.2
pip==24.3.1
papermill==2.6.0
plotnine==0.14.3
nbclient==0.10.1
nbformat==5.10.4
uuid==1.30
quarto-cli==1.6.37
Github files: