Quarto render with .cmd file - r

Wrote a previous question related to rendering a quarto document with a .cmd file (quarto_render broken from .bat / .cmd file), but with the recent updates to RStudio, the pathing has changed as well as the commands needed for rendering a quarto doc as html, and I am once again stuck.
Much like before, this is a multi-step process, though I think I have a better understanding, thanks to the previous responses. For one thing, learned that the quarto render executable is from RStudio, not from R, which means updates to the RStudio IDE have a greater impact on the rendering process than R language updates.
RStudio version
(RStudio 2022.12.0+353 "Elsbeth Geranium" Release (..., 2022-12-03) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36)
R Version (4.2.2)
File 1 - test_doc.qmd
Create a new .qmd document (I called mine test_doc.qmd).
Set to an output of html, and kept default YAML and other text. No modifications.
File 2 - test.cmd
After running the first two lines in the command prompt, and PAUSE the Error output is written below. This is a vexing error, since I've tried various iterations of the code below to account for this error, but then keep getting other error messages
{Command Prompt}
D:
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" render "C:\Users\%usernmae%\OneDrive - ...\Projects\Test\test_doc.qmd" PAUSE
ERROR: Error executing 'Rscript': program not found
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Results of Quarto Check in RStudio Terminal
[>] Checking Quarto installation......OK
Version: 1.2.269
Path: d:\Program Files\RStudio\resources\app\bin\quarto\bin
CodePage: 1252
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........OK
Version: 4.2.2
Path: D:/Program Files/R/R-4.2.2
LibPaths:
- D:/Program Files/R/R-4.2.2/library
rmarkdown: 2.20
[>] Checking Knitr engine render......OK
Results of Quarto Check in Command Prompt
{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" check
[>] Checking Quarto installation......OK
Version: 1.2.269
Path: D:\Program Files\RStudio\resources\app\bin\quarto\bin
CodePage: 1252
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Although, there is an install of 4.2.2 located in the D drive as well...
and quarto.exe --help in RStudio Terminal
quarto.exe --help
Usage: quarto
Version: 1.2.269
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
add <extension> - Add an extension to this folder or project
install [target...] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
Results in Command Prompt
{Command Prompt}
D:\>"D:\Program Files\RStudio\resources\app\bin\quarto\bin\quarto.exe" --help
Usage: quarto
Version: 1.2.269
Description:
Quarto CLI
Options:
-h, --help - Show this help.
-V, --version - Show the version number for this program.
Commands:
render [input] [args...] - Render files or projects to various document types.
preview [file] [args...] - Render and preview a document or website project.
serve [input] - Serve a Shiny interactive document.
create [type] [commands...] - Create a Quarto project or extension
create-project [dir] - Create a project for rendering multiple documents
convert <input> - Convert documents to alternate representations.
pandoc [args...] - Run the version of Pandoc embedded within Quarto.
run [script] [args...] - Run a TypeScript, R, Python, or Lua script.
add <extension> - Add an extension to this folder or project
install [target...] - Installs an extension or global dependency.
publish [provider] [path] - Publish a document or project. Available providers include:
check [target] - Verify correct functioning of Quarto installation.
help [command] - Show this help or the help of a sub-command.
Needless to say, any help with this would be greatly appreciated. Have tried variations on the theme above, but am really struggling with figuring this process out. Thank you for the assist!

Related

nbconvert failed: No suitable chromium executable found on the system. Please use '--allow-chromium-download' to allow downloading one

Getting error as "nbconvert failed: No suitable chromium executable found on the system. Please use '--allow-chromium-download' to allow downloading one." while trying to download jupyter notebook file (.ipynb) as a PDF file
Install and execute pyppeteer-install in your command prompt as below:
pyppeteer-install
[INFO] Starting Chromium download.
100%|█| 137M/137M
[INFO] Beginning extraction
[INFO] Chromium extracted to: C:\Users\AppData\Local\pyppeteer\pyppeteer\local-chromium\588429
Now the selected ipynb file should get extracted as a PDF while downloading with the "PDF via HTML (.pdf)" option.

Anaconda/Jupyter notebook/500 : Internal Server Error/windows 10/python3

I am learning data science with python and R, in my first course i downloaded python3, R and Rstudio and in the current course i am learning using jupyter and downloaded anaconda to handle jupyter notebook. when i tried to convert .ipyth file to PDF i ran into the following error message
nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex .\notebook.tex -quiet" command:
This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
.tex -quiet
?
! Emergency stop.
<*> .\notebook
.tex -quiet
No pages of output.
Transcript written on ?.
Appreciate your support taking in consideration that i am new to programming
Unfortunately, there's very little maintenance of LaTeX in nbconvert -- LaTeX conversions are a complex beast and there's not someone keeping it fed overtime for all the many edge cases and build tool changes.
There is a new webpdf conversion using chromium to generate PDF files coming in 6.0, which trades off some of the flexibility of xelatex / pandoc for consistency with web renderings (and a new optional dependency).
(source: GitHub)
The maintainers are trying to get the last of issues resolved for a final release our of alpha for 6.0. There's just not many of us with a lot of free time to contribute.
BTW what worked for me is to first download the .ipynb file as ".Tex" file and then converting that .Tex file into .pdf
Open cmd and run the following code there:
pip install nbconvert==5.4.1
This solved my issue.
P.S. you may try the latest version.
Source: https://github.com/jupyter/notebook/issues/3629#issuecomment-482692594

Shiny app executable with latex and pandoc

I'm currently developing a shiny app that I want to install in different computers that currently doesn't have R, LaTex and pandoc install. I found this blog https://www.r-bloggers.com/deploying-desktop-apps-with-r/ where it is explain how to do this. I followed all their instructions and it work great until I generate some pdf that I wrote with knitr. The error I get is:
Warning: Error in htmlwidgets::saveWidget: Saving a widget with selfcontained = TRUE requires pandoc. For details see:
https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md
which I interpret as you don't have Pandoc, and I will probably get the same for LaTex if the code gets there.
I know I have to install portable MikTex and portable pandoc in the same folder I have the shiny app and the portable R and Chrome, so I downloaded from here https://miktex.org/portable and here https://github.com/pandoc-extras/pandoc-portable and install theme. But this did not work
Reading the R blogger and the other webpage cited there I know I have to change somewhere in the code, maybe the .bat or in R or in some file of MikTex and pandoc, the direction that R is going to use but I just have no idea how to do this.
The .bat file currently has:
SET ROPTS=--no-save --no-environ --no-init-file --no-restore --no-Rconsole
R-Portable\App\R-Portable\bin\Rscript.exe %ROPTS% runShinyApp.R 1> ShinyApp.log 2>&1
Thanks in advance

php-cs-fixer got broken for linux users after fixing the issue 6 for windows users

I use Linux Ubuntu 16.04. I have well installed php-cs-fixer for atom 1.9.8.
$ php-cs-fixer
PHP CS Fixer version 1.11.6 by Fabien Potencier
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
fix Fixes a directory or a file
help Displays help for a command
list Lists commands
readme Generates the README content, based on the fix command help
self-update Update php-cs-fixer.phar to the latest version.
selfupdate Update php-cs-fixer.phar to the latest version.
The problem comes with config of php-cs-fixer with atom. In fact, package requires:
a PHP Executable path (which is by defaut php) (for linux user it must be empty which is not possible with actual version of the package) (see isse #6 )
a PHP-CS fixer Executable path (which is simply for linux user php-cs-fixer (without the use of PHAR file))
Consequently, when I run php-cs-fixer from atom I get this error: Could not open input file: php-cs-fixer.
I can generate this error message with this console command:
php php-cs-fixer fix Class.php
Could not open input file: php-cs-fixer
So, can you make PHP Executable path optional (not compulsory) for that package of atom???
thanks,
Update on this issue:
I managed to download php-cs-fixer.phar from https://github.com/FriendsOfPHP/PHP-CS-Fixer and I put it in the folder ~/.composer/ so that:
a PHP Executable path is php
a PHP-CS fixer Executable path is: ~/.composer/php-cs-composer.phar
But now I am getting this error: Could not open input file: ~/.composer/php-cs-fixer.phar
So what's wrong??
For you information, running the console php ~/.composer/php-cs-composer.phar Class.php command is successful.
The solution is found on github:
a PHP Executable path is php
a PHP-CS fixer Executable path is: /home/username/.composer/php-cs-composer.phar and don't use the ~ in atom.

How to install the knitr-module in Lyx 2.0.3?

I just installed Lyx 2.0.3 on my iMac and MacBook Air. When trying to open a *.lyx document on the iMac I get the following error-message:
"The module knitr has been requested by this document but has not been
found in the list of available modules. If you recently installed it,
you probably need to reconfigure LyX."
On the MacBook Air everything runs fine without any errors.
Any ideas how to install the knitr-module manually?
Thanks
The only requirement of the knitr module in LyX is R: you have to make sure the executable Rscript is in your PATH; you can test it by:
which Rscript
If you see the path to Rscript, you are ready to go (Tools-->Reconfigure); otherwise you have to tell LyX where is Rscript (add the path to PATH prefix):
then reconfigure LyX.
You can get the path to Rscript by executing this in R:
R.home('bin')

Resources