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

Quitting from lines ... #466

Closed
nick-youngblut opened this issue Apr 11, 2018 · 8 comments
Closed

Quitting from lines ... #466

nick-youngblut opened this issue Apr 11, 2018 · 8 comments

Comments

@nick-youngblut
Copy link

nick-youngblut commented Apr 11, 2018

packrat::status() is quitting due to lines of code that I have in a .Rmd file. The error is:

> packrat::status()
Quitting from lines 80-92 (01_demultiplex.Rmd) 
Quitting from lines 80-92 (01_demultiplex.Rmd) 
Error in if (pkg$name == pkgName) return(pkg) : 
  argument is of length zero
In addition: There were 11 warnings (use warnings() to see them)

Lines 79-92 of 01_demultiplex.Rmd (one code chunk; R):

job = 'bash -c "source activate {conda_env}; {cmd}"'
cmd = "qiime tools import \
  --type EMPPairedEndSequences \
  --input-path {input_dir} \
  --output-path georg_seqs.qza"

cmd = sprintf(cmd, input_dir=georg_read_dir)

job = glue(job, conda_env=conda_env, cmd=cmd)

Sys.setenv(CMD=job)
print(job)

The multi-line string isn't the problem. If I comment-out these lines, they still cause the error. If I remove these lines, I get the following error:

> packrat::status()
running: bash  -c '# already ran
echo $CMD'
running: bash  -c 'ls -thlc *.qza'
Quitting from lines 90-91 (01_demultiplex.Rmd) 

The code chunk ({bash, cache=TRUE}) causing the problem is:

ls -thlc *.qza

Any ideas on what's going wrong? The code chunks don't seem that weird, so I would think that other users would have already run into similar problems.

sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRblas.so
LAPACK: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] phyloseq_1.22.3      BiocInstaller_1.28.0 RevoUtilsMath_10.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16        compiler_3.4.3      pillar_1.2.1        plyr_1.8.4         
 [5] XVector_0.18.0      iterators_1.0.9     tools_3.4.3         zlibbioc_1.24.0    
 [9] digest_0.6.15       packrat_0.4.9-1     evaluate_0.10.1     jsonlite_1.5       
[13] tibble_1.4.2        nlme_3.1-131        rhdf5_2.22.0        gtable_0.2.0       
[17] lattice_0.20-35     mgcv_1.8-22         pkgconfig_2.0.1     rlang_0.2.0        
[21] Matrix_1.2-12       foreach_1.4.4       igraph_1.2.1        yaml_2.1.18        
[25] parallel_3.4.3      knitr_1.20          stringr_1.3.0       cluster_2.0.6      
[29] Biostrings_2.46.0   RevoUtils_10.0.7    S4Vectors_0.16.0    IRanges_2.12.0     
[33] rprojroot_1.3-2     multtest_2.34.0     stats4_3.4.3        ade4_1.7-11        
[37] grid_3.4.3          Biobase_2.38.0      data.table_1.10.4-3 survival_2.41-3    
[41] rmarkdown_1.9       reshape2_1.4.3      ggplot2_2.2.1       magrittr_1.5       
[45] backports_1.1.2     htmltools_0.3.6     splines_3.4.3       scales_0.5.0       
[49] codetools_0.2-15    MASS_7.3-47         BiocGenerics_0.24.0 biomformat_1.6.0   
[53] permute_0.9-4       ape_5.1             colorspace_1.3-2    stringi_1.1.7      
[57] lazyeval_0.2.1      munsell_0.4.3       vegan_2.4-6 
@DaveParr
Copy link

Same issue. Also with sql chunks.

@joelnitta
Copy link

Same here:

Quitting from lines 149-156 (report.Rmd) 

The offending lines contain a ggplot2 call

ggplot(align_stats, aes(y=100*..count../sum(..count..), x=mean_coverage, color=mcl_settings)) +
  geom_density() +
  ylab("Rel. count (alignments)") +
  scale_y_continuous(labels = scales::percent) +
  xlab("mean non-missing data per alignment") +
  scale_x_continuous(labels = scales::percent)

And FWIW, I have another similar ggplot call soon after that doesn't cause any problems

ggplot(align_stats, aes(y=100*..count../sum(..count..), x=length, color=mcl_settings)) +
  geom_density() +
  ylab("Rel. count (alignments)") +
  scale_y_continuous(labels = scales::percent) +
  xlab("Alignment length (bp)")

@kevinushey
Copy link
Contributor

A small, self-contained reproducible example would be helpful here. For example, a sample project (maybe hosted on GitHub) that, if I were to attempt to clone with Git and then call packrat::status() -- if I am able to reproduce the issue, then I can more easily investigate.

Attempting to call packrat::status() on a project containing a file hello.Rmd with the contents:

---
title: "Untitled"
output: html_document
---

```{r}
ggplot(align_stats, aes(y=100*..count../sum(..count..), x=mean_coverage, color=mcl_settings)) +
  geom_density() +
  ylab("Rel. count (alignments)") +
  scale_y_continuous(labels = scales::percent) +
  xlab("mean non-missing data per alignment") +
  scale_x_continuous(labels = scales::percent)
```

is not sufficient for me to reproduce the issue.

@joelnitta
Copy link

Sorry for the insufficient comment Kevin. I should have taken the time to document it properly, because now I can't get the error again either! I will post a proper reprex if it comes up again.

@mdpead
Copy link

mdpead commented Nov 8, 2018

I'm pretty sure this is a problem with the cache = TRUE option being set in the chunk. I had the same problem and removing this seems to have fixed it.

@dchiu911
Copy link

dchiu911 commented Nov 4, 2019

I am coming across this issue, and I think it has to do with packrat::status() not honouring the default knitr::opts_knit$set(eval.after = "fig.cap") when evaluating .Rmd files. I get two lines
Quitting from lines ... when setting fig.cap=cap with cap assigned in the chunk itself, but the warning disappears when I replace cap with the expression.

@dchiu911
Copy link

dchiu911 commented Nov 4, 2019

Hi @kevinushey

I've created a test project and ran a reprex at dchiu911/packrat-status#1. Could you try cloning to see if you can reproduce? Thanks!

@aronatkins
Copy link
Contributor

This problem was caused by using rmarkdown::render to analyze R Markdown files for dependencies.

We believe that this is resolved with #647.

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

7 participants