problems knit'ing when using a tikz device from a networked drive

197 views
Skip to first unread message

killeveritt

unread,
May 2, 2012, 10:41:09 AM5/2/12
to kn...@googlegroups.com
Not sure if this is a issue with knitr/r-studio or my MikTex installation. I get the following error when trying to knit a simple .Rnw where the plot is using dev='tikz':

Creating new TikZ metrics dictionary in:
knitr-example-tikzDictionary
pdflatex.exe: Windows API error 161: The specified path is invalid.
pdflatex.exe: Data: F:\R\code\figure\.:F:/R/code:
Warning: running command 'C:\PROGRA~1\MIKTEX~1.9\miktex\bin\pdflatex.exe "minimal-boring-plots1.tikz"' had status 1
label: boring-plots (with options) 
List of 4
 $ dev       : chr "tikz"
 $ fig.width : num 8
 $ fig.height: num 8
 $ out.width : chr "1\\linewidth"

Error in process_file(text) : 
  Quitting from lines 45-50: Error : failed to compile figure/minimal-boring-plots1.tikz to PDF

If I copy my .Rnw file to the local C:\ drive, it works fine (I google'd the MikTex error and found that it for some reason doesn't like networked drives but that was in the context of bibtex and the issue was fixed back in 2007). However, I can compile normal pdf plots on the networked drive. So not sure where the problem is or anyone else has had this issue.

Any suggestions/workarounds would be helpful.

Thanks



But the setup is as follows:

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] tikzDevice_0.6.2 filehash_2.2-1   knitr_0.5        ggplot2_0.9.0   

loaded via a namespace (and not attached):
 [1] codetools_0.2-8    colorspace_1.1-1   dichromat_1.2-4    digest_0.5.2       evaluate_0.4.2    
 [6] formatR_0.4        grid_2.15.0        highlight_0.3.1    MASS_7.3-17        memoise_0.1       
[11] munsell_0.3        parser_0.0-14      plyr_1.7.1         proto_0.3-9.2      RColorBrewer_1.0-5
[16] Rcpp_0.9.10        reshape2_1.2.1     scales_0.2.0       stringr_0.6        tools_2.15.0  

Yihui Xie

unread,
May 2, 2012, 3:36:23 PM5/2/12
to killeveritt, kn...@googlegroups.com
Thanks for reporting the issue. I'm able to reproduce it in a network
drive under Windows, so I'll investigate into it.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

Yihui Xie

unread,
May 2, 2012, 7:47:51 PM5/2/12
to killeveritt, kn...@googlegroups.com
Can you try the latest version on Github? https://github.com/yihui/knitr

el231bat

unread,
May 3, 2012, 10:07:33 AM5/3/12
to kn...@googlegroups.com, killeveritt
For some reason, I can't get the install_github to work for any package - I'm guessing it has something to do with configuring https proxy in R (because I can install packages from CRAN just-fine)

> install_github('knitr', 'yihui')
Installing github repo(s) knitr/master from yihui
Installing knitr.zip from https://github.com/yihui/knitr/zipball
Error in function (type, msg, asError = TRUE)  : couldn't connect to host

I'd love to try it out. Is there any other way to install it - I already got Rtools and devtools?

el231bat

unread,
May 3, 2012, 10:33:58 AM5/3/12
to kn...@googlegroups.com, killeveritt
So I think I got the trunk build from github manually (the version showed up in the documentation as 0.5.2 and the latest from CRAN is 0.5):

C:\download\yihui-knitr-9a5aafe>"C:\Program Files\R\R-2.15.0\bin\i386\R.exe" CMD INSTALL .
* installing to library 'C:/Program Files/R/R-2.15.0/library'
* installing *source* package 'knitr' ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
   'knitr-intro.Rnw'
** testing if installed package can be loaded

* DONE (knitr)

Same problem with tikz device from a networked drive. Hopefully 0.5.2 has the change that you made (and this isn't just spam)

Thanks 

Yihui Xie

unread,
May 3, 2012, 12:54:48 PM5/3/12
to el231bat, kn...@googlegroups.com
That is a correct alternative way to install the development version,
and is actually what devtools does internally.

Are you still using RStudio? Network drives under Windows are a little
bit tricky (due to the stupid UAC restrictions); one thing you need to
make sure is that you open the Rnw from F:/R/code instead of a
location like \\server\root\sub when this location is mapped to the F
drive. In other words, you need to convince/cheat Windows that "I'm
running my programs in a 'local' drive so please forget about UAC".

Please let me know if this works.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


el231bat

unread,
May 3, 2012, 2:30:42 PM5/3/12
to kn...@googlegroups.com, el231bat
Yes, still using RStudio. If your asking whether I compile the file as this: knit('//server/mydir/R/code/blah.Rnw'), then the answer is is no; it's mapped as a F:\ drive and I do everything using that. 

I'm curious why the pdf device works fine in this setup but not the tikz. 

Also curious - when you suggested using the latest from Github, where you saying that because you had just released the 0.5 version and you thought it might work with that? I was looking at the project commit history and I think you added a comment for this issue to a log file but no code changes. 

Thanks


On Thursday, May 3, 2012 12:54:48 PM UTC-4, Yihui Xie wrote:
That is a correct alternative way to install the development version,
and is actually what devtools does internally.

Are you still using RStudio? Network drives under Windows are a little
bit tricky (due to the stupid UAC restrictions); one thing you need to
make sure is that you open the Rnw from F:/R/code instead of a
location like \\server\root\sub when this location is mapped to the F
drive. In other words, you need to convince/cheat Windows that "I'm
running my programs in a 'local' drive so please forget about UAC".

Please let me know if this works.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Yihui Xie

unread,
May 3, 2012, 2:47:50 PM5/3/12
to el231bat, kn...@googlegroups.com
The change is here:
https://github.com/yihui/knitr/commit/75a3d842743dc7492442dc68c50aa746b332217d

The tikz plot (essentially a tex document) needs to be compiled to
PDF, which adds a slight complication.

To open the Rnw file from F:\.. or \\server\.. leads to different
consequences, although they are identical physically. Make sure you
open it from File-->Open File, then choose the file from the F drive.

If it still does not work, you can try to comment out the two lines in R/plot.R:

oti = Sys.getenv('TEXINPUTS'); on.exit(Sys.setenv(TEXINPUTS = oti))
Sys.setenv(TEXINPUTS = str_c(owd, oti, sep = ':'))

and reinstall the package. Then see if it works. I cannot reproduce
your problem on a network drive, so you probably need to debug it by
yourself.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Reply all
Reply to author
Forward
0 new messages