Pandoc error while converting .md to .docx file - runtime-error

While attempting to convert .md to docx file using command line:
pandoc CustomerChurn_predict.md -s -o churn.docx
I got following error:
pandoc: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.

This seems like a memory allocation error.
See: VirtualAlloc MEM_COMMIT and MEM_RESERVE
Pandoc may use rather large amount of memory for conversion.
See also Pandoc's FAQ:
Pandoc sometimes uses too much memory. How can I limit the memory used by pandoc?
pandoc +RTS -M30m -RTS will limit heap memory to 30MB. When converting a document requires more than this, an out of memory error will be issued.
The error message reports the limitation of your page file:
The paging file is too small for this operation to complete.
Can you increase the page file size?

Related

Running R tikzDevice with tinytex: Help troubleshooting `! LaTeX Error: File `tikz.sty' not found`

I am trying to generate a tikz plot using R/ggplot2 via the tikzDevice package. I've had to wade through many errors as I figured out how to install R and tinytex on my docker image, but I've run into the following error which has simply stumped me.
When I run the code that generates my plot, this is the error I get:
Error in getMetricsFromLatex(TeXMetrics, verbose = verbose) :
TeX was unable to calculate metrics for:
\char77
Run the following commands for diagnosis:
tikzTest()
tikzTest("\\char77")
Common reasons for failure include:
* The string contains a character which is special to LaTeX unless
escaped properly, such as % or $.
* The string makes use of LaTeX commands provided by a package and
the tikzDevice was not told to load the package.
The TeX and log files used for the calculation can help diagnose the
problem. If these files are missing, rerun the plot and make sure to
keep the R session open.
TeX file: tikzStringWidthCalc.tex
Log file: tikzStringWidthCalc.log
Calls: <Anonymous> ... descentDetails.text -> grid.Call -> <Anonymous> -> getMetricsFromLatex
Execution halted
And the output of tikzDevice::tikzTest() is as follows:
Active compiler:
/home/jovyan/.TinyTeX/bin/x86_64-linux/pdflatex
pdfTeX 3.141592653-2.6-1.40.23 (TeX Live 2021)
kpathsea version 6.3.3
Measuring dimensions of: A
Running command: '/home/jovyan/.TinyTeX/bin/x86_64-linux/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/tmp/RtmpLhckyy/tikzDevice29a5e00452e' 'tikzStringWidthCalc.tex'
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
TeX was unable to calculate metrics for:
A
Contents of TeX file tikzStringWidthCalc.tex:
\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage[active,tightpage,psfixbb]{preview}
\PreviewEnvironment{pgfpicture}
\setlength\PreviewBorder{0pt}
\usepackage{tikz}
\usepackage[T1]{fontenc}
\usetikzlibrary{calc}
\batchmode
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt, outer sep=0pt, scale=1] (TeX) {A};
\path let \p1 = ($(TeX.east) - (TeX.west)$),
\n1 = {veclen(\x1,\y1)} in (TeX.east) -- (TeX.west)
node{ \typeout{tikzTeXWidth=\n1} };
\end{tikzpicture}
\end{document}
Contents of log file tikzStringWidthCalc.log:
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (TeX Live 2021) (preloaded format=pdflatex 2022.3.16) 16 MAR 2022 23:30
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**tikzStringWidthCalc.tex
(/tmp/RtmpLhckyy/tikzDevice29a5e00452e/tikzStringWidthCalc.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24> (/home/jovyan/.TinyTeX/texmf-dist/tex/latex/base/article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(/home/jovyan/.TinyTeX/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)
\c#part=\count185
\c#section=\count186
\c#subsection=\count187
\c#subsubsection=\count188
\c#paragraph=\count189
\c#subparagraph=\count190
\c#figure=\count191
\c#table=\count192
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
! LaTeX Error: File `tikz.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.4 ^^M
Here is how much of TeX's memory you used:
235 strings out of 480236
3181 string characters out of 5895451
287032 words of memory out of 5000000
18278 multiletter control sequences out of 15000+600000
469259 words of font info for 28 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
34i,0n,38p,138b,36s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
As you can see I am using tinytex, but I have installed the recommended packages for this setup as described in the tinytex documentation (i.e., I've already ran tlmgr install pgf preview xcolor).
I've read every post I could possibly find on this subject but am coming up empty. Any tips to help me troubleshoot this problem would be greatly appreciated.
it would help if you had a minimum reproducible example to check on our end.
This said, the message LaTeX Error: File `tikz.sty' not found. suggests that a possible solution would be for you to throw:
library(tinytex)
tlmgr_search('/tikz.sty') # search for tikz.sty
tlmgr_install('pgf') # install the psnfss package
tlmgr_update() # update everything
since tlmgr_search('/tikz.sty') gives you
tlmgr search --file --global "/tikz.sty"
tlmgr.pl: package repository https://ctan.mirror.garr.it/mirrors/ctan/systems/texlive/tlnet
pgf:
texmf-dist/tex/latex/pgf/frontendlayer/tikz.sty
but then you already installed pgf... that's where tikz.sty lives.

Rmarkdown tabu.sty error in PDF output with libraries

Hello R community i'm trying to knit a pdf document, but get an error and cannot find the right answer in any forum. I'm using the latest R(4.1) and Rstudio(1.4). I have MiKTeX installed but I can not get a pdf to write unless I changed the global setting in R to write from tiny tex.
I have isolated the problem in the script. If I try to knit the document without loading any libraries, the document WILL knit. If I try to knit with libraries, then I throw a tabu.sty error. The problem here is I need the libraries for tables, graphs, etc.
! LaTeX Error: File `tabu.sty' not found.
! Emergency stop.
<read *>
Error: LaTeX failed to compile Chapter0.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Chapter0.log for more info.
Execution halted```

reading a huge csv file using cudf

I am trying to read a huge csv file CUDF but gets memory issues.
import cudf
cudf.set_allocator("managed")
cudf.__version__
user_wine_rate_df = cudf.read_csv('myfile.csv',
sep = "\t",
parse_dates = ['created_at'])
'0.17.0a+382.gbd321d1e93'
terminate called after throwing an instance of 'thrust::system::system_error'
what(): parallel_for failed: cudaErrorIllegalAddress: an illegal memory access was encountered
Aborted (core dumped)
If I remove cudf.set_allocator("managed")
I get
MemoryError: std::bad_alloc: CUDA error at: /opt/conda/envs/rapids/include/rmm/mr/device/cuda_memory_resource.hpp:69: cudaErrorMemoryAllocation out of memory
I am using CUDF through rapidsai/rapidsai:cuda11.0-runtime-ubuntu16.04-py3.8
I wonder whar could be the reason of hitting memory, while I can read this big file with pandas
**Update
I installed dask_cudf
and used dask_cudf.read_csv('myfile.csv') - but still get the
parallel_for failed: cudaErrorIllegalAddress: an illegal memory access was encountered
If the file you are reading is larger than the memory available then you will observe an OOM(Out Of Memory) error as cuDF runs on a sigle GPU.
In order to read files which are very large I would recommend using dask_cudf.
Check out this blog by Nick Becker on reading larger than GPU memory files. It should get you on your way.

Failed to compile test.tex after successful TinyTeX installation via tinytex

I am trying to install TinyTeX via the convenient tinytex-package for R.
After having had a few issues with getting the installation to run smoothly on MacOS, the install_tinytex() function now executes properly and ends with the statement:
TinyTeX installed to /Users/X/Library/TinyTeX
However, when trying to execute pdflatex('test.tex') to test the installation, the console instead returns:
Error: Failed to compile test.tex
Apparently the installation did not execute properly. Am I missing something or isn't this supposed to work after a successful TinyTeX installation via tinytex?
The texput.log displays the following error message:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2018.11.2) 2 NOV 2018 14:47
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**test.tex
! Emergency stop.
<*> test.tex
Here is how much of TeX's memory you used: 3 strings out of 494585
99 string characters out of 6174649 51539 words of memory out of
5000000 3743 multiletter control sequences out of 15000+600000 3640
words of font info for 14 fonts, out of 8000000 for 9000 14
hyphenation exceptions out of 8191 0i,0n,0p,1b,6s stack positions out
of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
The quoted error message indicates that there is no file test.tex in your current working directory. Either create a sample LaTeX file or use an existing file. If you do not have any LaTeX file available, you can try
pdflatex('sample2e.tex')
This will translate smaple2e.tex, which should be part of every LaTeX distribution.

Error with knitr on texmaker

I am trying for the first time to get knitr running on texmaker, I followed this documentation and I am on Windows 7. However, when I compile, I get the following error stack:
Process started
Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines
In addition: Warning message: In readLines(if (is.character(input2)) { : cannot open file 'try_easy.Rnw': No such file or directory
Execution halted
Process exited with error(s)
I tried to google it, but only found references to linux/unix, which were not helpful for my case. Following is my short test document:
\documentclass[a4paper]{article}
\begin{document}
<<a>>=
x=rnorm(100)
<<b>>=
<<a>>
mean(x)
#
\end{document}
It's my first time on stackoverflow, so please tell me if you need more information or I did something wrong. Thank you very much.
Update
Hello everyone,
I managed to find out my mistake. For the sake of future google-searchers, I had saved the file as a .tex instead as .rnw. Saving as rnw solved it. Since I cannot answer my own questions, I edit it here.
This error happens when the file is saved as a .tex instead of a .Rnw, as the compiler does not know that he should "knitr-compile" files that have the .tex handle, unless you specifically set him up like that.

Resources