[luatex] external modules from the (Linux) distro

Taco Hoekwater taco at elvenkind.com
Tue Aug 9 19:33:04 CEST 2011


Hi Manuel,


On Aug 9, 2011, at 7:20 PM, Manuel Pégourié-Gonnard <mpg at elzevir.fr> wrote:

> Hi,
> 
> I installed a JSON lua module using the tools of my distro (aptitude install
> liblua5.1-json) and it (obviously) works fine with stock lua.
> 
> However, I can't easily use it with LuaTeX (tested in texlua mode, kpse not
> initialised):
> 
>  module 'json' not found:
>    no field package.preload['json']
>    no file './json.lua'
>    no file '/usr/local/share/lua/5.1/json.lua'
>    no file '/usr/local/share/lua/5.1/json/init.lua'
>    no file '/usr/local/lib/lua/5.1/json.lua'
>    no file '/usr/local/lib/lua/5.1/json/init.lua'
>    no file './json.so'
>    no file '/usr/local/lib/lua/5.1/json.so'
>    no file '/usr/local/lib/lua/5.1/loadall.so'
> 
> The file is there: /usr/share/lua/5.1/json.lua
> 
> Probably if I had installed it myself using luarocks it would be in
> /usr/local/share and eveything would work, which is great, but it's a bit
> frustrating that it doesn't work when the file is installed in /usr/share. For
> reference, the search path of my (Debian) stock Lua is as follows:
> 
>    no field package.preload['nonesuch']
>    no file './nonesuch.lua'
>    no file '/usr/local/share/lua/5.1/nonesuch.lua'
>    no file '/usr/local/share/lua/5.1/nonesuch/init.lua'
>    no file '/usr/local/lib/lua/5.1/nonesuch.lua'
>    no file '/usr/local/lib/lua/5.1/nonesuch/init.lua'
>    no file '/usr/share/lua/5.1/nonesuch.lua'
>    no file '/usr/share/lua/5.1/nonesuch/init.lua'
>    no file './nonesuch.so'
>    no file '/usr/local/lib/lua/5.1/nonesuch.so'
>    no file '/usr/lib/lua/5.1/nonesuch.so'
>    no file '/usr/local/lib/lua/5.1/loadall.so'
> 
> May I suggest to make texlua's search path look this way too? It looks quite
> reasonable and universal (as opposed to distro-specific) this way.

Package.path in luatex is initialized according to the stock lua distribution's default. And by that I mean the stock lua from www.lua.org, not the patched debian version ... and I am sure you see where this is going ...

> PS: I'm aware I can fix package.path in my script before using require, I just
> think it would be better if it worked OOTB.

... and it would have worked OOTB, if Debian had not altered the lua settings. 

Anyway, have you tried setting LUA_PATH in the environment? If that does not work, then we can think of altering luatex itself.

Best wishes,
Taco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20110809/d48eb28b/attachment.html>


More information about the luatex mailing list