Closed jrtheobald closed 8 months ago
what if you open an R terminal and type library(rlang)
?
The first error message indicates a corrupted R package installation independent of Quarto.
Could you format your code properly using four backticks to enclose your document?
Does R is available in your PATH? Did you register R in the Windows registry when you installed it? Because quarto check should have found R, but did not so something is not standard in your setup.
quarto render document.qmd
You probably need to run quarto render hello.qmd
instead, since that's the name of your document.
There's some kind of issue with the qmd file provided in the Quarto tutorial. New qmd files seem to render just fine.
There's some kind of issue with the qmd file provided in the Quarto tutorial. New qmd files seem to render just fine.
Which file are you referring to?
Based on your log, I think you have an issue with your environment configuration.
(|) Checking R installation...........R scripting front-end version 3.6.1 (2019-07-05)
This means that Rscript --version
is using R 3.6.1 and not R 4.3.2 as you are mentioning.
Quarto is calling RScript
, and quarto check
is calling Rscript --version
to have the version number.
So definitely something happening in which version Quarto is using.
unable to load shared object 'C:/Users/jrthe/AppData/Local/R/win-library/4.3/rlang/libs/x64/rlang.dll':
As mentioned above this means that the rlang package used as an issue loading. It should be the same issue in your R console.
So something is not right in your environment.
gcm Rscript
or CMD and where Rscript
$env:QUARTO_LOG_LEVEL="DEBUG"
in PowerShell for example, then running quarto render
There's some kind of issue with the qmd file provided in the Quarto tutorial
The file at https://quarto.org/docs/get-started/hello/rstudio.html will use a bunch of packages, including tidyverse , which includes rlang.
Thank you
I had a similar issue, and following cderv's suggestion, I found that I had installed anaconda that had installed R version 3.6.1. I am able to render after uninstalling anaconda.
I found that I had installed anaconda that had installed R version 3.6.1. I am able to render after uninstalling anaconda.
@adugyamfinicholas Thanks for this information. Was anaconda environment activated when you ran Quarto ? I am guessing this could explain how the R anaconda got into the PATH.
I'll try to think about ways to maybe detect anaconda R and warn or message about this π€
@cderv Maybe worth adding the path of the R detected by quarto check
as done for Python and Quarto.
With the path of the R executable, it would have been easy to see the anaconda issue.
@mcanouil Sorry I do not follow - in a working quarto check
the Path is shown
[>] Checking R installation...........OK
Version: 4.3.2
Path: C:/PROGRA~1/R/R-43~1.2
LibPaths:
- C:/Users/chris/AppData/Local/R/win-library/4.3
- C:/Program Files/R/R-4.3.2/library
knitr: 1.45.9
rmarkdown: 2.25
See Path
field in the output
With the path of the R executable, it would have been easy to see the anaconda issue.
Issue here is that an error happens during quarto check knitr
which lead to undetected R installation, so nothing reported.
We improved the reporting in Quarto 1.4 (especially in debug verbose mode, and probably there the path is shown even when error), and we have an improvement issue for quarto check
output opened already.
So we'll do the necessary improvement, but the path of the R detected by quarto check
is already in the logged output
Yes I know it is supposed to "work".
I was referring to the truncated quarto check
output which somehow did not show any of the usual information because of the failure you talked about.
What I was saying/suggesting was to show Path independently of the results of the status checks. Status checks should not error out but print errors only and keep doing its job.
(|) Checking R installation...........R scripting front-end version 3.6.1 (2019-07-05)
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Thanks for the clarification. That makes more sense.
We already did this in https://github.com/quarto-dev/quarto-cli/pull/7013 by adding more information about R found in debug mode. (https://quarto.org/docs/troubleshooting/#verbose-mode). We could revisit it, but it is best discussed in another issue. Thanks.
I found that I had installed anaconda that had installed R version 3.6.1. I am able to render after uninstalling anaconda.
@adugyamfinicholas Thanks for this information. Was anaconda environment activated when you ran Quarto ? I am guessing this could explain how the R anaconda got into the PATH.
I'll try to think about ways to maybe detect anaconda R and warn or message about this π€
Yes anaconda environment was activated when I run render in rstudio. Anothing interesting find was that it only occured when i am in an R project environment, when i am not it worked fine.
Initially, I believed there was an issue with one of the qmd files provided in one of the tutorials (Palmer penguins). I thought that because new files would render, but the tutorial's file would not. I again attempted to render a new file today, but I saved it a few days ago and returned to it today. The file I created would not render. I uninstalled Anaconda, and now the file renders. I suppose the problem arises from having both Rstudio/R and Anaconda/R (although I only wanted to use Anaconda for Python).
- Can you check if you have different R installations?
I initially had multiple versions of R. In troubleshooting I uninstalled all versions of R, Rstudio, and Anaconda. Then I reinstalled the latest versions of R and Rstudio, and Anaconda.
Can you check which RScript is in PATH?
- open PowerShell and do
gcm Rscript
or CMD andwhere Rscript
Running gcm Rscript
did not returned an error that Rscript is unrecognizable, object not found.
Can you provide us with more debug information by
installing latest 1.4 version
Activating verbose mode (https://quarto.org/docs/troubleshooting/#verbose-mode) setting the env var
$env:QUARTO_LOG_LEVEL="DEBUG"
in PowerShell for example, then runningquarto render
The current version of Quarto installed is 1.4.542.
There's some kind of issue with the qmd file provided in the Quarto tutorial
The file at https://quarto.org/docs/get-started/hello/rstudio.html will use a bunch of packages, including tidyverse , which includes rlang.
I think I had all the required packages installed and loaded when I tried to render. But when I create a new Quarto document preloaded with code absent any packages even that would not render.
I have also encountered this issue when attempting to render a Quarto document in R (not RStudio - it works fine in RStudio). My environment is:
@cderv's advice to set the env var QUARTO_LOG_LEVEL="DEBUG"
was very helpful in diagnosing my issues.
It works when I set the env var QUARTO_R = "C:/Program Files/R/R-4.3.2/bin"
or QUARTO_R = "C:/Program Files/R/R-4.3.2/bin/x64"
. It does not work when I set the env var to QUARTO_R = "C:/Program Files/R/R-4.3.2"
, which I mention as it wasn't immediately obvious to me from reading https://quarto.org/docs/computations/r.html#installation.
It also works after I set the env var R_HOME = "C:/Program Files/R/R-4.3.2/bin"
or R_HOME = "C:/Program Files/R/R-4.3.2/bin/x64"
. It does not work with the following:
R_HOME = "C:/PROGRA~1/R/R-43~1.2"
(the default)R_HOME = "C:/PROGRA~1/R/R-43~1.2/bin"
R_HOME = "C:/PROGRA~1/R/R-43~1.2/bin/x64"
R_HOME = "C:/Program Files/R/R-4.3.2"
Is it intended that it would work with the default R_HOME
value? This seems ideal to me.
Finally, I found that quarto was unable to find R via the registry because of a Group Policy set by my IT dept. reg query HKLM\Software\R-core\R\4.3.2 Patched /v InstallPath
returns ERROR: Registry editing has been disabled by your administrator.
. When I execute quarto check
in PowerShell opened as admin, it is able to find R via the registry. Is there an alternative method of checking the registry that will not get blocked by a Group Policy? FWIW, R's base::readRegistry
works for me without admin rights.
Without applying these solutions, Quarto attempts to find Rscript in program files, happens to find the oldest version of R I have installed on my machine, and then encounters some error. See below for relevant verbose results from calling quarto check
via R (i.e. shell("quarto check")
).
-- Searching for R binary --
Looking for 'Rscript' in QUARTO_R: undefined
Looking for 'Rscript' in R_HOME: C:/PROGRA~1/R/R-43~1.2
Looking for 'Rscript' in PATH.
[execProcess] CMD /C where Rscript
(|) Checking R installation...........[execProcess] Success: false, code: 1
Looking for 'Rscript' in Windows Registry.
[execProcess] reg query HKCU\Software\R-core\R /v Current Version
[execProcess] Success: false, code: 1
[execProcess] reg query HKLM\Software\R-core\R /v Current Version
[execProcess] Success: false, code: 1
Looking for 'Rscript' in Windows PROGRAMFILES.
Found C:\Program Files\R\R-4.0.2\bin
[execProcess] C:\Program Files\R\R-4.0.2\bin\Rscript --version
(/) Checking R installation...........R scripting front-end version 4.0.2 (2020-06-22)
(-) Checking R installation...........[execProcess] Success: true, code: 0
++R found at C:\Program Files\R\R-4.0.2\bin\Rscript is not working properly.
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
Thanks in advance for your time!
It does not work when I set the env var to QUARTO_R = "C:/Program Files/R/R-4.3.2", which I mention as it wasn't immediately obvious to me from reading quarto.org/docs/computations/r.html#installation.
We could improve documentation at https://quarto.org/docs/computations/r.html#installation maybe. It is implied from the sentence
You can override the version of R used by Quarto by setting the QUARTO_R environment variable.
that a path where R binaries can be found should be provided.
Is it intended that it would work with the default R_HOME value? This seems ideal to me.
As this is the default value, and we wanted to use it, we do append bin/
directly to it as we know the binaries should be in it
https://github.com/quarto-dev/quarto-cli/blob/1263080154060a3292f2c677468a2421aa3b8de6/src/core/resources.ts#L101-L118
We don't do that assumption with QUARTO_R
because as this is user-defined, we expect a path that directly contains the R binaries.
https://github.com/quarto-dev/quarto-cli/blob/1263080154060a3292f2c677468a2421aa3b8de6/src/core/resources.ts#L85-L99
Finally, I found that quarto was unable to find R via the registry because of a Group Policy set by my IT dept. reg query HKLM\Software\R-core\R\4.3.2 Patched /v InstallPath returns ERROR: Registry editing has been disabled by your administrator.. When I execute quarto check in PowerShell opened as admin, it is able to find R via the registry. Is there an alternative method of checking the registry that will not get blocked by a Group Policy? FWIW, R's base::readRegistry works for me without admin rights.
This is interesting feedback. I'll try to see if I can reproduce, and see if there is a solution we could leverage, that don't required admin right. I wasn't aware of this admin requirement to be honest... π€
Without applying these solutions, Quarto attempts to find Rscript in program files, happens to find the oldest version of R I have installed on my machine, and then encounters some error. See below for relevant verbose results from calling quarto check via R
This is surprising why R 4.0.2 would not work. I'll try to reproduce also. π€
Thank you for using Quarto and reporting an issue!
Unfortunately, this issue is now considered stale because it has been opened since 14 days without providing a "working" reproducible example to help us investigate. If you are still facing the issue, please review the "Bug Reports" guide on how to provide a fully reproducible example as a self-contained Quarto document or a link to a Git repository. Without a reproducible example, it is unlikely that the issue will be addressed.
You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````
).
````qmd
---
title: "Reproducible Quarto Document"
format: html
---
This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.
```{r}
plot(cars)
The end.
Bug description
While running the demonstration provided by the Quarto website with a qmd document about palmer penguins in R studio on Windows I receive an error.
No report renders. The following is the session info for R studion:
And the stack trace on windows in powershell as requested in the bug report guide:
R studio version:
Steps to reproduce
{r}
| label: load-packages
| include: false
library(tidyverse) library(palmerpenguins)
Meet Quarto
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org/.
Meet the penguins
The penguins data from the palmerpenguins package contains size measurements for r nrow(penguins) penguins from three species observed on three islands in the Palmer Archipelago, Antarctica.
The plot below shows the relationship between flipper and bill lengths of these penguins.
{r}
| label: plot-penguins
| warning: false
| echo: false
ggplot(penguins, aes(x = flipper_length_mm, y = bill_length_mm)) + geom_point(aes(color = species, shape = species)) + scale_color_manual(values = c("darkorange","purple","cyan4")) + labs( title = "Flipper and bill length", subtitle = "Dimensions for penguins at Palmer Station LTER", x = "Flipper length (mm)", y = "Bill length (mm)", color = "Penguin species", shape = "Penguin species" ) + theme_minimal()
C:\Users\jrthe\Documents\quarto_practice>quarto check Quarto 1.4.542 [>] Checking versions of quarto binary dependencies... Pandoc version 3.1.11: OK Dart Sass version 1.69.5: OK Deno version 1.37.2: OK [>] Checking versions of quarto dependencies......OK [>] Checking Quarto installation......OK Version: 1.4.542 Path: C:\Users\jrthe\AppData\Local\Programs\Quarto\bin CodePage: unknown
[>] Checking tools....................OK TinyTeX: (not installed) Chromium: (not installed)
[>] Checking LaTeX....................OK Tex: (not detected)
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....OK Version: 3.11.5 (Conda) Path: C:/Users/jrthe/anaconda3/python.exe Jupyter: 5.3.0 Kernels: ir, python3
[>] Checking Jupyter engine render....OK
(|) Checking R installation...........R scripting front-end version 3.6.1 (2019-07-05) [>] Checking R installation...........(None)