pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.62k stars 518 forks source link

Torch module not found #1072

Closed Moamoza closed 4 years ago

Moamoza commented 4 years ago

Hi, I did all things that mentioned on the web for running my code which requires "torch", but I get an error and I don't know [why] I will appreciate it if anyone could help me?

D:\zerobrane\bin\lua.exe: D:\zerobrane\myprograms\test.lua:2: module 'torch' not found: no field package.preload['torch'] no file 'C:\Torch\install\share\lua\5.1\torch.lua' no file 'C:\Torch\install\share\lua\5.1\torch\init.lua' no file 'C:\Torch\share\lua\5.1\torch.lua' no file 'C:\Torch\share\lua\5.1\torch\init.lua' no file 'C:\Torch\torch.lua' no file 'C:\Torch\torch\init.lua' no file '.\torch.lua' no file 'D:\zerobrane\bin\lua\torch.lua' no file 'D:\zerobrane\bin\lua\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 'D:\zerobrane\lualibs/torch/torch.lua' no file 'D:\zerobrane\lualibs/torch.lua' no file 'D:\zerobrane\lualibs/torch/torch/init.lua' no file 'D:\zerobrane\lualibs/torch/init.lua' no file 'C:\Torch\install\lib\lua\5.1\torch.dll' no file 'C:\Torch\install\lib\lua\5.1\loadall.dll' no file 'C:\Torch\install\lib\torch.dll' no file 'C:\Torch\lib\lua\5.1\torch.dll' no file 'C:\Torch\lib\lua\5.1\loadall.dll' no file 'C:\Torch\lib\torch.dll' no file 'C:\Torch\torch.dll' no file '.\torch.dll' no file 'D:\zerobrane\bin\torch.dll' no file 'D:\zerobrane\bin\loadall.dll' no file 'D:\zerobrane\bin/clibs/torch.dll' stack traceback: [C]: in function 'require' D:\zerobrane\myprograms\test.lua:2: in main chunk [C]: at 0x00401b00

pkulchenko commented 4 years ago

Where are your torch libraries located? What instructions are you following? If you are not using torch7 package, you'll need to specify path to your torch libraries, so that your script can find them.

Moamoza commented 4 years ago

I am following this website. I downloaded the zip file from here and in the IDE, I specify the location of this file.(user.lua) and then I get this error.

pkulchenko commented 4 years ago

Where are the libraries located that you installed from WindowsTorch and what do you specify in user.lua? Where do you run the script from?

Moamoza commented 4 years ago

My files from WindowsTorch are located in C:\Torch\ in the user.lua I set path.torch = [[C:/Torch/]] (also tried C:/Torch/bin/). I also downloaded this file and located in packages of zerobrane. My scripts are in the myprograms folder in zerobrane files.

pkulchenko commented 4 years ago

It's not going to work this way; you have to tell your script where the Torch libraries are. If your script works outside of the IDE, it will also work inside of it, but in this case I doubt that it would run outside, as you didn't set the path to find the libraries.

You'll have to add something like this at the beginning of your script: package.cpath = [[C:\Torch\bin\lib?.dll]] (before require "torch" call).

You also need to make sure you are using 32-bit torch binaries if you want to use debugging from the IDE, as it will require loading 32-bit socket DLL (included with the IDE) that is not going to work in a 64-bit process.