Skip to content
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

Code Profiling unable to produce html output #116

Closed
Pweidemueller opened this issue Mar 12, 2020 · 7 comments
Closed

Code Profiling unable to produce html output #116

Pweidemueller opened this issue Mar 12, 2020 · 7 comments

Comments

@Pweidemueller
Copy link

I'm using Rstudio with R version 3.6.2 on MacOS Catalina. I installed R through anaconda into a specified environment. Using the conda-forge distribution I installed theprofvis (version: 0.3.6) package.

When I try to profile e.g. a selected line in a script by clicking Profile -> Profile Selected Line(s) the profiling runs but I get following error and not html output is generated:

sh: /Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc: Not a directory
Warning message:
In system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) :
  running command ''/Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc' --version' had status 126

When I check in my terminal where pandoc is located (which pandoc), I get following output:

/Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc

And checking for the version (pandoc --version), I get:

pandoc 2.9.2
Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2
Default user data directory: /Users/pweide/.local/share/pandoc or /Users/pweide/.pandoc
Copyright (C) 2006-2019 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose

So I'm wondering why profvis adds another pandoc to the path (/Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc) to identify the version? Obvisously /Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc does not exist, hence the error.

How can I redirect profvis to use the right path?

@wch
Copy link
Member

wch commented Mar 12, 2020

What happens when you run:

library(profvis)
profvis({
  # code here
})

If that works, but Profile -> Profile Selected Line(s) does not, then it is probably an issue with the RStudio IDE, and you can file it here:
https://github.com/rstudio/rstudio/issues

@Pweidemueller
Copy link
Author

Pweidemueller commented Mar 12, 2020

Thank you for your fast reply! Unfortunately the error stays the same.

library(profvis)
profvis({
  test_strings <- rep("test 134", 331582)
  Genes <- lapply(test_strings, function(x) unlist(strsplit(as.character(x), " "))[1])
})

The error remains:

sh: /Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc: Not a directory
Warning message:
In system(paste(shQuote(pandoc_path), "--version"), intern = TRUE) :
  running command ''/Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc' --version' had status 126

@wch
Copy link
Member

wch commented Mar 12, 2020

I suspect this is a problem with the htmlwidgets package looking for pandoc in the wrong place.

If you run this:

p <- profvis({
  # Code here
})

htmlwidgets::saveWidget(p, "profile.html")

I think the same error will occur when you run saveWidget.

The error you're getting is coming from here:

https://github.com/ramnathv/htmlwidgets/blob/b3573236c4553019b30e595adcb4fbe693f4a834/R/pandoc.R#L280-L281

If I'm right about this, then I suggest filing an issue on the htmlwidgets repository.

@wch
Copy link
Member

wch commented Mar 12, 2020

Also, you can probably reproduce the error by calling:

htmlwidgets:::find_pandoc()

@Pweidemueller
Copy link
Author

Yes, both htmlwidgets::saveWidget(p, "profile.html") and htmlwidgets:::find_pandoc() reproduce the error.

When I try rmarkdown:::pandoc(), it actually finds the right directory. So your hunch might be right that it is an error in htmlwidgets package. I will ask my question there.

@hadley
Copy link
Member

hadley commented Jun 26, 2020

Closing since resolved in the linked issue.

@hadley hadley closed this as completed Jun 26, 2020
@gsandrof66
Copy link

Hi everyone. I had the same problem. I solved it when I install xfun package and restart my environment.
install.packages("xfun")
I hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants