R knitr reports throwing "LC_CTYPE failed" error

LabKey Support Forum (Inactive)
R knitr reports throwing "LC_CTYPE failed" error balter  2016-12-08 10:14
Status: Closed
 
Status: Active
 
I have R configured as in https://www.labkey.org/home/Documentation/wiki-page.view?name=knitr#markdown2. My R is installed with conda in /opt/miniconda3/bin.

:/# R --version
/opt/miniconda3/bin/R: 12: [: Linux: unexpected operator
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"

:/# conda list | grep knitr
r-knitr 1.12.3 0 bioconda

When I try to view an knitr report, I get

Error executing command

javax.script.ScriptException: javax.script.ScriptException: An error occurred when running the script 'script.R', exit code: 1).
/opt/miniconda3/bin/R: 12: [: Linux: unexpected operator
/opt/miniconda3/lib/R/bin/R: 12: [: Linux: unexpected operator
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
Error: unexpected symbol in "Taken from"
Execution halted

UPDATE:
------
I tried running it with knitr options set to "none", and "a=10" being the only command in the file. This time I get:

/opt/miniconda3/bin/R: 12: [: Linux: unexpected operator
/opt/miniconda3/lib/R/bin/R: 12: [: Linux: unexpected operator
During startup - Warning message:
Setting LC_CTYPE failed, using "C"
> proc.time()
   user system elapsed
  0.316 0.076 0.358

So, the LC_CTYPE seems to be the main error?

However, I CAN set LC_CTYPE at the R console as the labkey user.

> Sys.getenv("HOME")
[1] "/home/labkey"
> Sys.setlocale("LC_CTYPE","C")
[1] "C"
> Sys.getlocale()
[1] "LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
>
 
 
Jon (LabKey DevOps) responded:  2016-12-11 23:16
Hi Ariel,

I've only see that type of error from trying to run a BASH script rather than an R script.

Are these errors being produced within LabKey via an RView or is it in R externally?

Can you provide us with a screenshot of the Engine Configuration you're using for R in LabKey?

It should look like the image as shown here under (Admin > Site > Admin Console > Views and Scripting): https://www.labkey.org/home/Documentation/wiki-page.view?name=knitr#markdown2

Regards,

Jon