I run lualatex in a process generated with a system call in Haskell. Lualatex stops with the error message Unable to read environment locale: exit now. The file compiles with lualatex when run from a terminal. The locale is set to en_US-UTF-8 (verified by locale); I have installed all other locales to avoid any mixup as indicated in another question and I have added in the file the recommended %%% eval: (setenv "LANG" "de_DE.UTF-8") there. All to no avail.

What else can I do?

I observed that the error message says

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

and the values are


i.e. the value to be set are en-US (with dash) and not en_US with underscore.

There seems some inference with the way I call the process; at least, one can say that lualatex is not resilient and does not produce a helpful error message (e.g. say what was found and what was expected).

  • Have you considered posting your query to a Haskell forum?
    – Mico
    Jun 20, 2020 at 16:33
  • @user855443 When you verified your locale, did you run locale from Haskell or directly? Jun 20, 2020 at 17:21
  • I did run locale from the command line - i will try it from a Haskell call. @Marcel Krüger: Thank you for the valuable suggestion!
    – user855443
    Jun 20, 2020 at 17:53
  • I have not found an answer, but the error went away. I noticed that somewhere the locale was set to en-US (with dash, not underbar). while searching for the cause it disappeared.
    – user855443
    Jun 21, 2020 at 13:46


You must log in to answer this question.

Browse other questions tagged .