I am trying to access SQLite databases from LuaLaTeX but am not able to load an installed lsqlite3 package. Here's what I tried so far:
- Took a brandnew Xubuntu 14.04 installation
- Installed a complete TeX Live 2014
- Installed Luarocks (which installed Lua5.1 on the way)
Used Luarocks to install
lsqlite3uwe@luabuntu:/media/uwe$ luarocks list
Installed rocks:
lsqlite3 0.9.1-2 (installed) - /usr/local/lib/luarocks/rocks
Appended the
package.pathin the following TeX file:\documentclass{article} \usepackage{luacode} \begin{document} \begin{luacode*} package.path="/usr/local/lib/luarocks/rocks;/usr/local/lib/luarocks/rocks/lsqlite3; /usr/local/lib/lua/5.1/lsqlite3.so" .. package.path require("lsqlite3") \end{luacode*} Hello Lua! \end{document}
The error I receive is the following:
! LuaTeX error [\directlua]:3: module 'lsqlite3' not found: no field package.preload['lsqlite3'] [luatexbase.loader] Search failed [kpse lua searcher] file not found: 'lsqlite3' [kpse C searcher] file not found: 'lsqlite3' [oberdiek.luatex.kpse_module_loader]-eroux Search failed stack traceback: [C]: in function 'require' [\directlua]:3: in main chunk. \luacode@dbg@exec ...code@maybe@printdbg {#1} #1 }l.9 \end{luacode*}
What must be set to have LuaLaTeX find the lsqlite3 package?
EDIT
I have tried to adjust everything following the comments below:
- Adjusted
/usr/local/texlive/2014/texmf.cnf - Put everything into the example
Still get the error about the missing
lsqlite3module with the following example\documentclass{article} \directlua{ require "lualoader" } \usepackage{fontspec} \usepackage[english]{babel} \begin{document} \directlua{package.path='/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/uwe/.luarocks/share/lua/5.1/?.lua;/home/uwe/.luarocks/share/lua/5.1/?/init.lua;/usr/share/lua/5.1//?.lua;/usr/share/lua/5.1//?/init.lua;./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua' package.cpath='/usr/local/lib/lua/5.1/?.so;/home/uwe/.luarocks/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;/usr/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so' require "lualoader" } \directlua{% local sqlite3 = require("lsqlite3") local db = sqlite3.open_memory() db:exec[[ CREATE TABLE test (id INTEGER PRIMARY KEY, content); INSERT INTO test VALUES (NULL, 'Hello World'); INSERT INTO test VALUES (NULL, 'Hello Lua'); INSERT INTO test VALUES (NULL, 'Hello Sqlite3') ]] for row in db:nrows("SELECT * FROM test") do tex.print(row.id .. " : ".. row.content ) end } \end{document}


lsqlite3is a binary module, at least in part. You probably have to setpackage.cpathas well. – Philipp Gesang Dec 21 '14 at 14:35cpathsetting, no success. Same error as before. – Uwe Ziegenhagen Dec 21 '14 at 22:06kpathseato use the additional path(s) – Uwe Ziegenhagen Dec 21 '14 at 22:08lualoadertwice in your edit, paths must be set before it is required – michal.h21 Dec 25 '14 at 18:44LUAINPUTS(example:export LUAINPUTS="~/code/tex/pgfplots/tex//:~/code/tex/pgf/generic//:"). There is also an environment variableCLUAINPUTS... perhaps you need to adopt it? I know that DLL search paths tend to need native load procedures, in other words: environment variables (don't know how that works in LUA, though) – Christian Feuersänger Dec 25 '14 at 19:55