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 #362

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

Code Profiling unable to produce html output #362

Pweidemueller opened this issue Mar 12, 2020 · 4 comments

Comments

@Pweidemueller
Copy link

Pweidemueller commented Mar 12, 2020

I posted the original question in the profvis repository, because that is when the error first occurred, however the problem seems to be within the htmlwidgets package: r-lib/profvis#116 (comment)

'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 following script, the profiling runs but I get an error and no html output is generated:

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

The error is the following:

sh: /Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc/pandoc: Not a directory
Error in strsplit(version_info, "\n")[[1]] : subscript out of bounds
In addition: 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 htmlwidgets 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 htmlwidgets to use the right path?

@jcheng5
Copy link
Collaborator

jcheng5 commented Mar 13, 2020

What does Sys.getenv("RSTUDIO_PANDOC") give you?

@Pweidemueller
Copy link
Author

> Sys.getenv("RSTUDIO_PANDOC")
[1] "/Users/pweide/opt/miniconda3/envs/r_env/bin/pandoc"

@jcheng5
Copy link
Collaborator

jcheng5 commented Mar 13, 2020

I'm not sure how that's getting set, but it should be /Users/pweide/opt/miniconda3/envs/r_env/bin/ (i.e. the directory where the pandoc binary lives, not the pandoc binary itself

@Pweidemueller
Copy link
Author

Hm, I see. For now I just set the variable inside my script
Sys.setenv(RSTUDIO_PANDOC="/Users/pweide/opt/miniconda3/envs/r_env/bin/")
But would be cool to find a solution to change the variable globally. I saw some possible solutions online.

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

2 participants