torch7 problem
Closed this issue · 6 comments
how to set path about using torch7 on Mac?
I have set path.torch follow this page http://notebook.kulchenko.com/zerobrane/torch-debugging-with-zerobrane-studio ,
but I get this error:
test.lua:1: module 'torch' not found:
no field package.preload['torch']
thanks very much.
@orange15, did you set path.torch
pointing to the th
executable or to the torch folder? Where is the torch library relative to the torch folder?
@pkulchenko, thank you for reply.
I have set path.torch like this:
path.torch = [[/Users/mac/torch/install/bin]]
when I run, there is error:
/Users/mac/Desktop/torch_test.lua:1: module 'torch' not found:
no field package.preload['torch']
no file '/Users/mac/torch/install/bin/share/lua/5.1/torch.lua'
no file '/Users/mac/torch/install/bin/share/lua/5.1/torch/init.lua'
no file '/Users/mac/torch/install/bin/torch.lua'
no file '/Users/mac/torch/install/bin/torch/init.lua'
no file './torch.lua'
no file '/usr/local/share/luajit-2.0.2/torch.lua'
no file '/usr/local/share/lua/5.1/torch.lua'
no file '/usr/local/share/lua/5.1/torch/init.lua'
no file './torch.lua'
no file './torch/init.lua'
no file './lua/torch.lua'
no file './lua/torch/init.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/torch/torch.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/torch.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/torch/torch/init.lua'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/lualibs/torch/init.lua'
no file '/Users/mac/torch/install/bin/lib/lua/5.1/torch.so'
no file '/Users/mac/torch/install/bin/lib/lua/5.1/loadall.so'
no file '/Users/mac/torch/install/bin/torch.so'
no file './torch.so'
no file '/usr/local/lib/lua/5.1/torch.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/libtorch.dylib'
no file '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/clibs/torch.dylib'
stack traceback:
[C]: in function 'require'
/Users/mo/Desktop/torch_test.lua:1: in main chunk
@orange15, did you select "torch" from the list of interpreters ("Project | Lua Interpreter | Torch")? For some reason I don't see the locations I'd expect to see if your selected "torch" as the interpreter.
What's the actual location of the torch library?
yes, I have selected "torch-7" as the interpreter, and the torch library in a custom path like "/Users/mac/torch".
path.torch = [[/Users/mac/torch/install/bin]]
@orange15, I figured out what's happening. You have several options:
- Point
path.torch
toth
file:path.torch = [[/Users/mac/torch/install/bin/th]]
. This will launchth
instead oflua
executable and it should be able to find its own libraries. - Point
path.torch
toinstall
folder (notbin
):path.torch = [[/Users/mac/torch/install/]]
. You may get an error aboutlibpaths
having the wrong architecture, which is caused by the fact thatlua
executable that is included with the IDE is 32bit, but libraries and executables included with torch are 64bit. To fix that you may need to addpath.lua = [[/Users/mac/torch/install/bin/luajit]]
, which will configure the IDE to use luajit from the torch install.
I'm also going to make a change so that you can specify [[/Users/mac/torch/]]
directory instead of [[/Users/mac/torch/install/]]
(either one will work).
Let me know if this still doesn't resolve the issue.
@pkulchenko it is ok. thank you.