I'm new to lua and recently learning DL with Torch.
I have installed torch just following instructions: http://torch.ch/docs/getting-started.html#_ and added some packages using luarocks install
. Then I wrote a test file:
require 'torch'
require 'nn'
--[[do something]]
when running with lua test.lua
(Ubuntu 14.04), it errs as followed:
error loading module 'libpaths' from file '/home/user1/torch/install/lib/lua/5.1/libpaths.so': /home/user1/torch/install/lib/lua/5.1/libpaths.so: undefined symbol: luaL_register
It seems something wrong with path settings or so. However, when I run test with command th
, it works fine.
I searched and examined these answers: Error loading module (Lua)
Torch7 Lua, error loading module 'libpaths' (Linux)
not fully answered my question though.
So I wonder where exactly the error comes from, and how to fix it. Even though I can use torch with th
.
ADD:
I find that the reason maybe API luaL_register
is not supported in ver 5.2 which is what I am using, while th
calls a lua shell in ver 5.1? So does this mean I can only use th
to run my files?
You are likely using your system Lua (probably version 5.2), but Torch requires LuaJIT it comes with. Run your script as luajit test.lua
(it's probably in /home/user1/torch/install/bin/luajit
).