-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbstata compiles document but does not work in interactive mode in quarto documents (in RStudio) #42
Comments
Thank you for reporting. I think that when you run stata interactively in RStudio, it's not actually using nbstata.[1] I bet you're using the knitr version of Stata instead (about which I only have a vague awareness). Maybe Stata 18 broke something about how knitr stata worked? I think you should instead report this to the knitr project (but do report back if you would).[2] By contrast, according to my hypothesis, when you render using Quarto, it is using nbstata and working. [1] One clue is that the Stata "splash," that several-line display of the Stata version and so on, is disabled by default in nbstata. It's also hard for me to imagine how nbstata could trigger an error like that. |
Thank you for the quick reply. Although that is not the exact issue, it did point me in the right direction. I am not very familiar with quarto but it does seem that in interactive mode, knitr is doing the job of executing the cells. I'll try to illustrate the issue here, as it might be helpful to others (or at least me in the future!) It seems that knitr creates a temporary
So it enters Stata in normal (not batch mode) and it never returns any output or error until I cancel the call via the stop button, when I can then see Stata's splash and the error ( Having said that, there is indeed a knitr engine called Having said all that, it is very likely that the issue is either with quarto or with knitr. I'll try to figure it out, and I'll link back to this issue any relevant info I find. By the way (not relevant to this issue) I also opened an issue in quarto's repository asking about support for |
One possible workaround would be setting a custom knitr engine and trying to make sure it points to python (jupyter) and uses Disclaimer: that I have a very shallow understanding of how knitr and jupyter kernels work. And here is a minumum reproducible example of a document.
Note that the document does not include the usual knitr setup chunk that a Rmarkdown usually includes. |
Thank you, @avila, for that quarto issue which led to nbstata support in the Quarto VSCode extension. I'd like to add further documentation directing people toward that extension (and also how to use nbstata with RStudio if there is a way), but I won't have time to work on it myself until July at the earliest. |
That's great that quarto is now supporting nbstata! I just did a quick test with simple documents, and it ran fine on VSCode (interactive execution and compilation). On RStudio the conflict between the default In any case, a quarto document with |
Description
I was trying to use nbstata interactively in RStudio but I cant get it to work as expected. Based on the example document from friosavila. First the chunks never finish running, and if I click the Stop button, then it returns an error (see screenshots below for more context).
The error is because the
do
command before thefilename
is missing. But one could expect the error to be returned more quickly.Click to expand (Screenshots)
The whole document is rendered fine though.
Click to expand (Screenshots)
The document was created with jupyter engine and nbstata kernel.
Click to expand (Screenshots)
I am also able to use nbstata kernel in jupyter notebooks, both interactively and also to compile the whole document. I might revert to this solution for the time being, but it would be great to have it working in Rstudio because I find it's notebook implementation very superior to the jupyter's interface.
Please let me know if there is anything I could try or am doing wrong. I am happy to debug and then document it for future users.
System
quarto check output
Click to expand (Long output)
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.3.450
Path: /home/avila/opt/quarto-1.3.450/bin
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.0
Path: /usr/bin/python3
Jupyter: 5.5.0
Kernels: python3, nbstata
() Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.3.2
Path: /usr/lib64/R
LibPaths:
- /home/avila/R/x86_64-redhat-linux-gnu-library/4.3
- /usr/local/lib/R/library
- /usr/lib64/R/library
- /usr/share/R/library
knitr: 1.45
rmarkdown: 2.25
[✓] Checking Knitr engine render......OK
The text was updated successfully, but these errors were encountered: