Lua debugger

2,104 views
Skip to first unread message

The Chemist

unread,
Feb 13, 2013, 11:07:57 PM2/13/13
to tor...@googlegroups.com
The folks at Unknown Worlds released their Lua IDE / Debugger:

It looks cool and useful, but it's only for Windows for now...

smth chntla

unread,
Feb 13, 2013, 11:26:08 PM2/13/13
to tor...@googlegroups.com
I've been hacking up ZeroBraneStudio to play nice with torch. I'll push some fixes when everything plays nice, but its nice, cross-platform and very very light-weight, has a nice visual debugging interface.

The Chemist

unread,
Feb 13, 2013, 11:38:03 PM2/13/13
to tor...@googlegroups.com
Nice, can't wait to see it!

smth chntla

unread,
Feb 14, 2013, 2:36:18 AM2/14/13
to tor...@googlegroups.com
So, I got the ZBS (ZeroBraneStudio) visual debugger working when there are no display functions. When there are any qt functions, the debugger crashes. The regular 'run' mode works even with qt functions.

You can get it with
cd zbs-torch
bash zbstudio.sh

However, for some strange reason, ZBS on my system starts the debugger with a hit and miss, i.e. not specific to torch, even vanilla Lua debugger. When the program takes about 5 seconds to start, the debugger works as expected, when it instantly starts, the debugger fails with (cant connect to host) or whatever bullshit error. I verified that the debugger server does bind and listen to the port, so I'm not sure what's the problem (the debugger is based on MobDebug). Anyways, someone verify if this strange ZBS behavior also occurs on their side.


smth chntla

unread,
Feb 14, 2013, 10:52:19 AM2/14/13
to tor...@googlegroups.com
I think I wasn't clear in my instructions. You also have to change the default interpreter to Torch-7 inside ZBS

cd zbs-torch
bash zbstudio.sh
You should also go to
Project->Lua Interpreter and set it to "Torch-7"
Project->Start Debugging

Also, I just restarted my computer, and the random bug I was talking about (in the second part of my post) doesn't seem to exist anymore.

Ya'ay for getting a visual debugger working (sucks though that we can't use it with QT enabled stuff).

The Chemist

unread,
Feb 14, 2013, 11:01:25 AM2/14/13
to tor...@googlegroups.com
Cool, will give it a try soon.

smth chntla

unread,
Feb 14, 2013, 11:08:53 AM2/14/13
to tor...@googlegroups.com
Alright, 
I pushed some more changes.
I got things to work when qt functions are there (like image.display()). 

I used the torch -onethread option, not sure what the shortcomings of that are. Are there any problems with using -onethread clement?


The Chemist

unread,
Feb 14, 2013, 11:11:07 AM2/14/13
to tor...@googlegroups.com
From memory, it means that the UI elements will be frozen when Lua code is being interpreted.

smth chntla

unread,
Feb 14, 2013, 1:28:58 PM2/14/13
to tor...@googlegroups.com
Gents,

I finally got a stable visual debugger working on torch (not singlethread, just the regular torch interpreter that we use).
I added instructions here

I tested it all day in my regular workflow in MacOSX 64-bit, and I installed torch with luarocks.

If there's issues, let me know.

Eugenio Culurciello

unread,
Feb 14, 2013, 1:55:15 PM2/14/13
to tor...@googlegroups.com
Very well done Soumith, that will make a lot of people happy!!!
I am now too used to debug old-style!!!
E

Alberto Albiol

unread,
Feb 26, 2013, 11:44:28 AM2/26/13
to tor...@googlegroups.com
Hello,
I am trying ZBS with no luck :-(

The first issue is that when I try to debug your simple example my debugger does not find the path variables and
I get something like:

error: [string "?"]:2: module 'paths' not found:
no field package.preload['paths']
no file 'lualibs/paths.lua'
no file 'lualibs/paths/paths.lua'
no file 'lualibs/paths/init.lua'
....

To overcome this issue I set these variables before I run  zbstudio.sh:
export LUA_PATH="./?.lua;/usr/local/share/torch/lua/?.lua;/usr/local/share/torch/lua/?/init.lua;/usr/local/lib/torch/?.lua;/usr/local/lib/torch/?/init.lua"
export LUA_CPATH=package.cpath..";/usr/local/lib/torch/?.dylib;"

Now torch starts in the debugger but now I get this errordlopen(/Users/alalbiol/Programacion/3rdparty/zbs-torch/bin/clibs/socket/core.dylib, 2): no suitable image found.  Did find:
/Users/alalbiol/Programacion/3rdparty/zbs-torch/bin/clibs/socket/core.dylib: mach-o, but wrong architecture

It looks like it is not finding the libraries installed by luarocks... If I start without require('mobdebug').start()
then the zerobrane studio executes de program, but obviously I can not debug :-(

Any ideas?

More info: 
1) I have compiled/installed on my own and it seems to work fine (at least from the console)
2) I installed luarocks using ports


I

smth chntla

unread,
Feb 26, 2013, 12:05:36 PM2/26/13
to tor...@googlegroups.com
Alberto,

Did you change the interpreter inside ZBS to torch7, i.e. 
Project->Lua Interpreter->Torch-7

Looks like your errors are stemming from that. I fixed those problems when the interpreter change script is called.

Let me know, it should be something trivial, I'll help you fix it.

w.r.t your first error, it is because you didn't install torch from luarocks, but by compiling/installing (so the LUA_PATH and LUA_CPATH are slightly different). I'll add patches for this.

Alberto Albiol

unread,
Feb 27, 2013, 5:02:56 AM2/27/13
to tor...@googlegroups.com
Hello again
It seems that all the problems are because I manually compiled torch.... I have installed torch using luarocks and now the debugger is 99% working.

I still have a problem and it is that I can not display images because torch does not find the libqttorch library... Problably because I am mixing installations

Is the torch-pkg method deprecated? so everyone is using luarocks install instead?

smth chntla

unread,
Feb 27, 2013, 12:36:07 PM2/27/13
to tor...@googlegroups.com
I think as we go forward, the "dictators" are going to make it luarocks only, so yea think of torch-pkg as almost deprecated. There is a thread in the forums about it i think.

Mikael Henaff

unread,
Apr 4, 2013, 10:52:56 PM4/4/13
to tor...@googlegroups.com
Hi Soumith,

I'm having trouble getting the debugger to work. I installed torch using luarocks and when I run zbstudio.sh I get the following error:

lua: error loading module 'wx' from file 'bin/libwx.dylib':
    bin/libwx.dylib: invalid ELF header
stack traceback:
    [C]: ?
    [C]: in function 'require'
    src/main.lua:46: in main chunk
    [C]: ?


According to this post (http://lua-users.org/lists/lua-l/2012-09/msg00220.html) it seems like this can be due to the wx library not being installed, but I was able to run the regular ZBS from their website fine, which also requires the wx library.

Any thoughts? I'm running Ubuntu 12.04.

Thanks a lot!
-Mikael

smth chntla

unread,
Apr 5, 2013, 12:51:30 AM4/5/13
to tor...@googlegroups.com
Mikael,

I have not tested it in Linux, only tested it in OSX. Can you check if the original zero-brane-studio works on your machine? The original ZeroBraneStudio is here https://github.com/pkulchenko/ZeroBraneStudio . As far as I know, I have not modified the wx parts for my setup, I only added one file,  interpreters/torch.lua  and added 64-bit socket libraries for OSX.

Let me know if the original ZeroBraneStudio works and we can try to figure out things from there.

--
Soumith

Mikael Henaff

unread,
Apr 5, 2013, 10:21:56 AM4/5/13
to tor...@googlegroups.com
Yes, I got the original ZeroBraneStudio to work. It also uses the wx library, so I'm not sure why the Torch version is not happy...

I'll look into it some more later today, let me know if you think of anything.

smth chntla

unread,
Apr 5, 2013, 12:09:06 PM4/5/13
to tor...@googlegroups.com
Mikael,

Great, I just merged the latest ZeroBraneStudio changes from pkulchenko's original branch. That should fix your linux issues (I see that they changed the start script), and I tested the merged changes on OSX, it doesn't break any torch-7 side of things. 

Let me know if you still have issues.
--
S

Mikael Henaff

unread,
Apr 6, 2013, 12:31:37 PM4/6/13
to tor...@googlegroups.com
Cool, it starts properly, however it doesn't let me choose torch as the interpreter.

When I go to Project -> Lua Interpreter, I see Torch-7 but it's grayed out and I can't select it.

smth chntla

unread,
Apr 6, 2013, 10:36:02 PM4/6/13
to tor...@googlegroups.com
Alright,

I finally got myself to start an Ubuntu VM and test it all out. I pushed some changes as well. 

I tested it out on
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Linux hex 3.2.0-34-generic #53-Ubuntu SMP Thu Nov 15 10:48:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


What I did was:
1. Install torch from luarocks using

2. get latest copy of zbs-torch

3. Start zbs-torch with bash (not default shell)
bash zbstudio.sh

4. Change the interpreter to torch-7

5. Test the example usage in

All seems to work well.

Let me know if you still have trouble. Sorry about not testing it out on Linux before-hand.

Mikael Henaff

unread,
Apr 8, 2013, 9:46:35 AM4/8/13
to tor...@googlegroups.com
Cool, it works now :D

Thanks a lot for putting this together!!!

yuey...@gmail.com

unread,
Jun 3, 2014, 6:17:34 AM6/3/14
to tor...@googlegroups.com
I'm trying to install zbs-torch on my Ubuntu 14.04 LTS, 64 bit.

I did steps 1-5 in your post, but when I try to debug the example usage code, the following appears in the output pane of zerobrane studio (at the bottom of the screen):

Can't find torch executable in any of the folders in PATH or TORCH_BIN: /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /home/yylim/local/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, /usr/games, /usr/local/games, /usr/local/lib/luarocks/rocks/torch, /usr/local/share/lua/5.1/, /usr/local/share/lua/5.1/torch, /usr/local/share/cmake/torch, /home/yylim/bin

I installed torch from luarocks, but I don't know what the "TORCH_BIN" is supposed to point to. So I search for all filepaths giving "torch" and added them to TORCH_BIN env variable. That's why you see the paths "/usr/local/lib/luarocks/rocks/torch, /usr/local/share/lua/5.1/, /usr/local/share/lua/5.1/torch, /usr/local/share/cmake/torch" above. But this didn't seem to solve the problem.

Any idea what the problem is?

soumith

unread,
Jun 3, 2014, 6:46:15 AM6/3/14
to torch7
If you are using the latest torch install, you no longer need to switch the interpreter to "torch7". 
This is because we are now fully compatible with LuaJIT, and ZeroBraneStudio works out of the box.

Only if you are using any QT functions, and you use "qlua", you switch the interpreter to "qlua".

The "torch7" interpreter is still left around in zbs-studio for legacy users still using "torch7-distro", which is essentially dead.

Let me know if you still have issues.


--
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+un...@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at http://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.

yuey...@gmail.com

unread,
Jun 5, 2014, 12:07:32 PM6/5/14
to tor...@googlegroups.com
I see... Thanks for the fast response.

Following your advice, I am using ZeroBraneStudio out of the box.

I only wished it's in-built console was more torch friendly, like providing torch help documention, auto-completion, and nice printing of tensors. But anyway, these are available in your trepl package, so I'm still happy.

Thank you for all your hard work!

Steve

unread,
Jun 20, 2014, 10:52:00 PM6/20/14
to tor...@googlegroups.com
I may be doing something wrong.
I installed torch's latest version (the torch commando is gone, th works fine, etc)
But ZeroBraneStudio doesn't seem to work out of the box because it seems to be running it's own version of lua.
I obviously have to change the interpreter but there's no qlua, torch nor luaJIT in the drop-drown menu (like there used to be with the 'zbs-torch' fork).
I'm running this on a mac, OS X 10.8, could this be the cause? I noticed it's using this path to run lua:

/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/lua.app/Contents/MacOS/lua

I guess I could edit the interpreter file directly but you mentioned it should run out of the box so maybe I'm missing something obvious.

Thanks!


On Tuesday, June 3, 2014 4:46:15 AM UTC-6, smth chntla wrote:
If you are using the latest torch install, you no longer need to switch the interpreter to "torch7". 
This is because we are now fully compatible with LuaJIT, and ZeroBraneStudio works out of the box.

Only if you are using any QT functions, and you use "qlua", you switch the interpreter to "qlua".

The "torch7" interpreter is still left around in zbs-studio for legacy users still using "torch7-distro", which is essentially dead.

Let me know if you still have issues.

soumith

unread,
Jun 22, 2014, 2:40:37 PM6/22/14
to torch7 on behalf of Steve
Steve,

Sorry for the late reply. 
ZeroBraneStudio now actually ships with LuaJIT as it's default interpreter (So, Lua in the interpreters menu is actually LuaJIT).

I have qlua in my zbs-torch branch if you want to debug with qlua.

Paul K

unread,
Jun 23, 2014, 1:36:01 AM6/23/14
to tor...@googlegroups.com
Hi Soumith,

You are absolutely right about current ZBS configuration: it includes LuaJIT as its default interpeter. I know you've deprecated torch7 interpreter, but I still think it may be worthwhile to wrap it into torch7 plugin for ZBS.

The plugin API in ZBS has been much improved in the last several version and allows to register various external components, like interpreters, specs, API descriptions, and some others.

It may be possible to use all that functionality to provide several things: (1) ability to provide a custom interpreter to start/stop debugging directly from ZBS (similar to the one you used to have), (2) ability to provide auto-complete and function descriptions for torch/image/nn packages, (3) support for custom visualizers; for example, to display tensor data in the console/tooltip/stack/watch windows. I do have several examples on how the plugin API can be used to integrate these components on the plugin page: http://studio.zerobrane.com/doc-plugin.html

Please let me now if there is interest in exploring this further.

Paul.

soumith

unread,
Jun 23, 2014, 4:05:20 AM6/23/14
to torch7 on behalf of Paul K
Paul,

Thanks for the details on better writing plugins.
I think it's time to write a proper plugin for ZBS for torch (with autocomplete etc.), zbs-torch was hackery at best.

Thanks for the great IDE!!
--
Soumith


--

Sander Stepanov

unread,
Jun 8, 2015, 2:49:29 PM6/8/15
to tor...@googlegroups.com
ok friends 
so for today 
which torch visual debugger may be used pls....?

On Wednesday, February 13, 2013 at 11:07:57 PM UTC-5, The Chemist wrote:
The folks at Unknown Worlds released their Lua IDE / Debugger:

It looks cool and useful, but it's only for Windows for now...

Jagadeesh Babu

unread,
Jul 2, 2015, 1:31:50 AM7/2/15
to tor...@googlegroups.com
Hi,

I am debugging with zbs-torch (downloaded from https://github.com/soumith/zbs-torch). I am running the example code given in the README (which containts image.display()). The code runs fine in the 'run' mode. However, when run in the 'debug' mode (with require('mobdebug').start()), the code crashes at image.display() with the following error:

Debugger server started at cool:8172.
Program starting as '"/home/jagadeesh/torch/install/bin/qlua" -e "xpcall(function() io.stdout:setvbuf('no'); require('mobdebug').loop('cool',8172) end,function(err) print(debug.traceback(err)) end)"'.
Program 'qlua' started in '/home/jagadeesh/zbs-torch/pratice' (pid: 4906).
Debugging session started in '/home/jagadeesh/zbs-torch/pratice/'.
qt.QtLuaMethodInfo (0xb221de70)
stack traceback:
    [C]: in function 'runsWithoutGraphics'
    ...adeesh/torch/install/bin/../share/lua/5.1/qtgui/init.lua:5: in main chunk
    [C]: in function 'require'
    ...esh/torch/install/bin/../share/lua/5.1/qtwidget/init.lua:3: in main chunk
    [C]: in function 'require'
    ...adeesh/torch/install/bin/../share/lua/5.1/image/init.lua:1239: in function 'display'
    displayimg.lua:5: in main chunk
Debugging session completed (traced 5 instructions).
Program completed in 10.44 seconds (pid: 4906).

Can anyone please explain what I am missing? Thanks..

Jagadeesh Babu

unread,
Jul 2, 2015, 1:34:59 AM7/2/15
to tor...@googlegroups.com
More info: I have changed the interpreter to QLua-LuaJit

Milton Wong

unread,
Jul 30, 2015, 12:06:15 AM7/30/15
to torch7
I also has the similar experience, In QLua-LuaJit mode, running the code is debug mode not working
Reply all
Reply to author
Forward
0 new messages