From hb at biostat.ucsf.edu  Fri Mar 15 18:09:10 2013
From: hb at biostat.ucsf.edu (Henrik Bengtsson)
Date: Fri, 15 Mar 2013 10:09:10 -0700
Subject: [Rd] Failed to locate 'weave' output file / vignette product
 does not have a known filename extension
In-Reply-To: <CAFDcVCS+1hW7EGgU4D6K=eRrpV9p4XY6V5+r_kNPSG9uZM=RSw@mail.gmail.com>
References: <CAF42j20rv=oXrCQ7=C=bp8cPQKOUnXjzg8yuE_MQaMzoN04g8g@mail.gmail.com>
	<CAFDcVCS+1hW7EGgU4D6K=eRrpV9p4XY6V5+r_kNPSG9uZM=RSw@mail.gmail.com>
Message-ID: <CAFDcVCScw2JkxruOg43GkHxWSbmwMkQwyOxSLE7a9h2GaJqMnQ@mail.gmail.com>

Hi.

I can reproduce 2 out of the 3 cases on R version 3.0.0 alpha
(2013-03-12 r62224) [Platform: x86_64-w64-mingw32/x64 (64-bit)].  The
error does not appear to be in the R vignette machinery but rather in
the vignettes themselves (or the packages they're using).  Comments
below.


On Wed, Mar 13, 2013 at 1:16 PM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:
> Hi,
>
> I contributed code to R r62130 which may be responsible for that (not
> sure).  I'll investigate as soon as got the time.
>
> /Henrik
>
> On Wed, Mar 13, 2013 at 10:17 AM, Dan Tenenbaum <dtenenba at fhcrc.org> wrote:
>> Hello,
>>
>> I'm seeing three different vignette-related errors with recent
>> versions of R-3.0.0 alpha.
>>


#############################################
# Case #1: BitSeq
#############################################

>> First, with the package BitSeq
>> (http://bioconductor.org/packages/2.12/bioc/html/BitSeq.html), I get
>> the following when trying to build the package:
>>
>> Error: processing vignette ?BitSeq.Rnw' failed with diagnostics:
>> Failed to locate the ?weave? output file (by engine ?utils::Sweave?)
>> for vignette with name ?BitSeq?. The following files exists in
>> directory ?.?: ?data-C0.est?, ?data-C1.est?, ?data-c0b0.prob?,
>> ?data-c0b0.rpkm?, ?data-c0b0.sam?, ?data-c0b0.thetaMeans?,
>> ?data-c0b1.rpkm?, ?data-c1b0.rpkm?, ?data-c1b1.rpkm?, ?data.estVar?,
>> ?data.means?, ?data.par?, ?data.pplr?, ?data.tr?, ?ensSelect1.fasta?,
>> ?ensSelect1.tr?, ?parameters1.txt?
>> Execution halted
>>
>> My guess is it's looking for BitSeq.tex, but it's not clear where it's
>> looking; the package is pretty straightforward, inst/doc contains
>> BitSeq.Rnw and nothing else (no Makefile).
>>

I failed to reproduce this when running the vignette manually;

> setwd("BitSeq/inst/doc/")
> Sweave("BitSeq.Rnw")
> tools:::find_vignette_product("BitSeq", by="weave")
[1] "BitSeq.tex"


However, when I look for the files listed in your error message I
don't find them in ".", but I do find them in
system.file("extdata",package="BitSeq").  Inspecting 'BitSeq.Rnw', I
find

# move to directory with the data
setwd(system.file("extdata",package="BitSeq"));

and at the very end

# restore the original working directory
setwd(old_directory);

My guess is that in your case there's an error occurring during Sweave
resulting in the current directory being incorrect upon return.  This
causes the tools:::find_vignette_product() assertion following
immediately after to look in the incorrect directory.

[ It should be easy to update the R vignette mechanism such that this
check for the vignette output is done in the proper directory
regardless whether the vignette changes the current working directory
or not. ]



#############################################
# Case #2: ppiData
#############################################

>> Next, the package ppiData whose source is here:
>> https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/pkgs/ppiData
>> (login: readonly password: readonly)
>>
>> As you can see, there is no .tex file in the source of the package,
>> but after running R CMD build on it, the resulting .tar.gz file
>> contains
>> ppiData/inst/doc/ppiData.tex
>> Then the package fails check (excerpt of ppiData.Rcheck/00install.out):
>>
>> Error in vignette_type(Outfile) :
>>   Vignette product ?ppiData.tex? does not have a known filename extension (?NA?)
>> ERROR: installing vignettes failed
>> * removing ?/home/biocbuild/bbs-2.12-data-experiment/meat/ppiData.Rcheck/ppiData?
>>
>> This package does not have a vignette Makefile either, so I'm not sure
>> why the tex file is included in the .tar.gz.

Building the vignette manually, I get:

> setwd("ppiData/inst/doc/")
> Sweave("ppiData.Rnw")
Writing to file ppiData.tex
Processing code chunks with options ...
[...]
Loading required package: lattice
 2 : echo keep.source term verbatim (label = collectData, ppiData.Rnw:79)

Error:  chunk 2 (label = collectData)
Error in as.list.default(org.Sc.sgdCOMMON2ORF) :
  no method for coercing this S4 class to a vector

Enter a frame number, or 0 to exit

1: Sweave("ppiData.Rnw")
2: driver$runcode(drobj, chunk, chunkopts)
3: RweaveTryStop(err, options)

Selection:

So, that appears to be the root of the problem.

The "Error in vignette_type(Outfile) : Vignette product 'ppiData.tex'
does not have a known filename extension ('NA')" occurs after R has
temporarily built the package and then tries to install it.  It fails
to pick up the above Sweave() error during the build process because
Sweave() leaves an (incomplete) 'ppiData.tex' file behind the R
vignette machinery believes it was successful and keeps going.

[ I don't know enough of the inner details of Sweave() and how it's
exception handling works, but hopefully it's possible to detect the
Sweave error and give a more informative error message earlier on. ]


>>
>> These two errors are with:
>>
>>> sessionInfo()
>> R version 3.0.0 alpha (2013-03-09 r62188)
>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>
>> locale:
>>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>  [7] LC_PAPER=C                 LC_NAME=C
>>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>>


#############################################
# Case #3: bumphunter
#############################################

>> I also get another error on windows only ( it builds successfully on
>> Mac and Linux) when trying to build bumphunter
>> http://bioconductor.org/packages/2.12/bioc/html/bumphunter.html
>>
>> Warning: running command
>> '"C:\PROGRA?2\MIKTEX?1.9\miktex\bin\texi2dvi.exe" --quiet --pdf
>> "bumphunter.tex"  -I
>> "E:/biocbld/bbs-2.12-bioc/R/share/texmf/tex/latex" -I
>> "E:/biocbld/bbs-2.12-bioc/R/share/texmf/bibtex/bst"' had status 1
>> Error in find_vignette_product(name, by = "texi2pdf", engine = engine) :
>>   Failed to locate the 'texi2pdf' output file (by engine
>> 'utils::Sweave') for vignette with name 'bumphunter'. The following
>> files exists in directory '.': 'bumphunter-clusterplot.pdf',
>> 'bumphunter-plotSegments.pdf', 'bumphunter.Rnw', 'bumphunter.bib',
>> 'bumphunter.tex'
>> Calls: <Anonymous> -> find_vignette_product
>> Execution halted
>>
>> I guess it's looking for bumphunter.pdf.

Yes.  The error message occurs as part of an assertion test
immediately after running texi2pdf() on the Sweave generated
'bumphunter.tex' file.  So, the error message is correct and it occurs
as soon as possible.  [ I'll see if we could also pick up and report
on the (below) warning message produced my 'texi2pdf', because that
would help the troubleshooting on the user end. ]

I can reproduce this on Windows (session details above), also when
building the vignette manually:

> setwd("bumphunter/vignettes/")
> Sweave("bumphunter.Rnw")  # successful
[...]
> tools::texi2pdf("bumphunter.tex")
Warning message:
running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\texi2dvi.exe"
--quiet --pdf "bumphunter.tex"  -I
"C:/PROGRA~1/R/R-3.0.0alpha/share/texmf/tex/latex" -I
"C:/PROGRA~1/R/R-3.0.0alpha/share/texmf/bibtex/bst"' had status 1

It turns out that the 'bumphunter.tex' file has an active file lock
that prevents texi2dvi.exe from compiling the file, e.g.

fileLocked <- function(file) {
  fileT <- sprintf("%s.tmp", file)
  ok <- file.rename(file, fileT)
  file.rename(fileT[ok], file[ok])
  names(ok) <- file
  !ok
}

> files <- list.files()
> files <- files[file_test("-f", files)]
> fileLocked(files)
 bumphunter-clusterplot.pdf bumphunter-plotSegments.pdf
                      FALSE                       FALSE
             bumphunter.Rnw              bumphunter.tex
                      FALSE                        TRUE


So, there is something that holds on to this file.  My guess it has to
do with the parallel computations via socket connections, e.g.

> showConnections()
  description       class      mode  text     isopen   can read
5 "<-hb-x201:11372" "sockconn" "a+b" "binary" "opened" "yes"
6 "<-hb-x201:11372" "sockconn" "a+b" "binary" "opened" "yes"
7 "<-hb-x201:11372" "sockconn" "a+b" "binary" "opened" "yes"
  can write
5 "yes"
6 "yes"
7 "yes"

Sure enough, doing:

> closeAllConnections()
> tools::texi2pdf("bumphunter.tex")

Now texi2dvi runs and it produces a PDF (though there is some bibtex
error, but that's a different story).


Hope this helps

/Henrik

>>
>> This is with:
>>
>>> sessionInfo()
>> R version 3.0.0 alpha (2013-03-09 r62188)
>> Platform: i386-w64-mingw32/i386 (32-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United States.1252
>> [2] LC_CTYPE=English_United States.1252
>> [3] LC_MONETARY=English_United States.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United States.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> thanks,
>> Dan
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Failed to locate 'weave' output file / vignette product does not have a known filename extension
Henrik Bengtsson