Can't load packages in qlua
nicholas-leonard opened this issue · 11 comments
I can't seem to be able to load packages in qlua
:
nicholas@xps:~$ qlua -limage
qlua: module 'image' not found:
no field package.preload['image']
no file '/home/nicholas/nikopia/image/init.lua'
no file '/usr/local/lib/lua/5.1/image.so'
stack traceback:
[C]: at 0x7faf95d56a20
[C]: at 0x7faf95b1def0
I installed qlua with
sudo luarocks install qtlua
I installed image with
sudo luarocks install image
Its not just the image package:
nicholas@xps:~$ qlua -ltorch
qlua: module 'torch' not found:
no field package.preload['torch']
no file '/home/nicholas/nikopia/torch/init.lua'
no file '/usr/local/lib/lua/5.1/torch.so'
stack traceback:
[C]: at 0x7fcc36901a20
[C]: at 0x7fcc366c8ef0
qlua works fine otherwise:
nicholas@xps:~$ qlua
Lua 5.1 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require 'qt'
>
post your OS and other relevant details.
Also, let me know if you have other versions of lua and luarocks on your system.
also, post the output of "luarocks install qtlua"
nicholas@xps:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
nicholas@xps:~$ sudo luarocks install qtlua
[sudo] password for nicholas:
Installing https://raw.github.com/torch/rocks/master/qtlua-scm-1.rockspec...
Using https://raw.github.com/torch/rocks/master/qtlua-scm-1.rockspec... switching to 'build' mode
Cloning into 'qtlua'...
remote: Counting objects: 171, done.
remote: Compressing objects: 100% (161/161), done.
remote: Total 171 (delta 9), reused 138 (delta 1)
Receiving objects: 100% (171/171), 358.34 KiB | 0 bytes/s, done.
Resolving deltas: 100% (9/9), done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DLUA=/usr/local/bin/luajit -DLUA_BINDIR="/usr/local/bin" -DLUA_INCDIR="/usr/local/include" -DLUA_LIBDIR="/usr/local/lib" -DLUADIR="/usr/local/lib/luarocks/rocks/qtlua/scm-1/lua" -DLIBDIR="/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib" -DCONFDIR="/usr/local/lib/luarocks/rocks/qtlua/scm-1/conf" && make
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt4: /usr/bin/qmake (found suitable version "4.8.1", required is "4.3.0")
-- Lua: using information from luarocks
-- Lua library guess (no info from luarocks): /usr/local/lib/libluajit.so
-- Looking for luaJIT_setmode in /usr/local/lib/libluajit.so
-- Looking for luaJIT_setmode in /usr/local/lib/libluajit.so - found
-- Lua found /usr/local/bin/luajit
-- Found readline library
-- Looking for rl_completion_matches
-- Looking for rl_completion_matches - found
-- Looking for include files HAVE_FCNTL_H
-- Looking for include files HAVE_FCNTL_H - found
-- Looking for include files HAVE_PTHREAD_H
-- Looking for include files HAVE_PTHREAD_H - found
-- Looking for include files HAVE_SIGNAL_H
-- Looking for include files HAVE_SIGNAL_H - found
-- Looking for include files HAVE_UNISTD_H
-- Looking for include files HAVE_UNISTD_H - found
-- Looking for include files HAVE_ERRNO_H
-- Looking for include files HAVE_ERRNO_H - found
-- Looking for include files HAVE_SYS_SELECT_H
-- Looking for include files HAVE_SYS_SELECT_H - found
-- Looking for include files HAVE_SYS_TIME_H
-- Looking for include files HAVE_SYS_TIME_H - found
-- Looking for include files HAVE_SYS_TYPES_H
-- Looking for include files HAVE_SYS_TYPES_H - found
-- Looking for isatty
-- Looking for isatty - found
-- Looking for sigprocmask
-- Looking for sigprocmask - found
-- Looking for sigaction
-- Looking for sigaction - found
-- Looking for signal
-- Looking for signal - found
-- Looking for pthread_sigmask
-- Looking for pthread_sigmask - not found.
-- Looking for XInitThreads
-- Looking for XInitThreads - not found
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_qtlua-scm-1-3518/qtlua/build
[ 1%] Generating moc_qtluaengine.cxx
[ 2%] Generating qtluaengine.moc
Scanning dependencies of target libqtlua
[ 3%] Building CXX object qtlua/CMakeFiles/libqtlua.dir/qtluautils.cpp.o
[ 4%] Building CXX object qtlua/CMakeFiles/libqtlua.dir/qtluaengine.cpp.o
[ 6%] Building CXX object qtlua/CMakeFiles/libqtlua.dir/moc_qtluaengine.cxx.o
Linking CXX shared library libqtlua.so
[ 6%] Built target libqtlua
[ 7%] Generating moc_qluaconsole.cxx
[ 8%] Generating qrc_qlua.cxx
[ 9%] Generating qluaapplication.moc
[ 10%] Generating qluaconsole_unix.moc
[ 12%] Generating moc_qluaapplication.cxx
Scanning dependencies of target libqlua
[ 13%] Building CXX object qlua/CMakeFiles/libqlua.dir/qluaapplication.cpp.o
[ 14%] Building CXX object qlua/CMakeFiles/libqlua.dir/qluaconsole_unix.cpp.o
In file included from /tmp/luarocks_qtlua-scm-1-3518/qtlua/qlua/qluaconsole_unix.cpp:1231:0:
/tmp/luarocks_qtlua-scm-1-3518/qtlua/qlua/qluaconsole_unix.cpp: In member function ‘void QLuaConsole::Private::command(Command)’:
/tmp/luarocks_qtlua-scm-1-3518/qtlua/qlua/qluaconsole_unix.cpp:774:46: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
[ 15%] Building CXX object qlua/CMakeFiles/libqlua.dir/moc_qluaapplication.cxx.o
[ 16%] Building CXX object qlua/CMakeFiles/libqlua.dir/qrc_qlua.cxx.o
[ 18%] Building CXX object qlua/CMakeFiles/libqlua.dir/moc_qluaconsole.cxx.o
Linking CXX shared library libqlua.so
[ 18%] Built target libqlua
Scanning dependencies of target qlua
[ 19%] Building CXX object qlua/CMakeFiles/qlua.dir/qlua.cpp.o
Linking CXX executable qlua
[ 19%] Built target qlua
Scanning dependencies of target libqtcore
[ 20%] Building CXX object packages/qtcore/CMakeFiles/libqtcore.dir/qtcore.cpp.o
Linking CXX shared module libqtcore.so
[ 20%] Built target libqtcore
[ 21%] Generating moc_qluamode.cxx
[ 22%] Generating qrc_qtide.cxx
[ 24%] Generating ui_qluagotodialog.h
[ 25%] Generating ui_qluafinddialog.h
[ 26%] Generating ui_qluareplacedialog.h
[ 27%] Generating qluatextedit.moc
[ 28%] Generating qluaide.moc
[ 30%] Generating qluamainwindow.moc
[ 31%] Generating qluabrowser.moc
[ 32%] Generating qluaeditor.moc
[ 33%] Generating qluasdimain.moc
[ 34%] Generating qluamdimain.moc
[ 36%] Generating qluamode.moc
[ 37%] Generating qluamode_txt.moc
[ 38%] Generating qluamode_hlp.moc
[ 39%] Generating qluamode_lua.moc
[ 40%] Generating qluamode_c.moc
[ 42%] Generating moc_qluatextedit.cxx
[ 43%] Generating moc_qluaide.cxx
[ 44%] Generating moc_qluamainwindow.cxx
[ 45%] Generating moc_qluabrowser.cxx
[ 46%] Generating moc_qluaeditor.cxx
[ 48%] Generating moc_qluasdimain.cxx
[ 49%] Generating moc_qluamdimain.cxx
Scanning dependencies of target libqtide
[ 50%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qtide.cpp.o
[ 51%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluatextedit.cpp.o
[ 53%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluaide.cpp.o
[ 54%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamainwindow.cpp.o
[ 55%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluabrowser.cpp.o
[ 56%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluaeditor.cpp.o
[ 57%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluasdimain.cpp.o
[ 59%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamdimain.cpp.o
[ 60%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamode.cpp.o
[ 61%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamode_txt.cpp.o
[ 62%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamode_hlp.cpp.o
[ 63%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamode_lua.cpp.o
[ 65%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qluamode_c.cpp.o
[ 66%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/qrc_qtide.cxx.o
[ 67%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluatextedit.cxx.o
[ 68%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluaide.cxx.o
[ 69%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluamainwindow.cxx.o
[ 71%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluabrowser.cxx.o
[ 72%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluaeditor.cxx.o
[ 73%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluasdimain.cxx.o
[ 74%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluamdimain.cxx.o
[ 75%] Building CXX object packages/qtide/CMakeFiles/libqtide.dir/moc_qluamode.cxx.o
Linking CXX shared module libqtide.so
[ 75%] Built target libqtide
[ 77%] Generating moc_qtlualistener.cxx
[ 78%] Generating qtluapainter.moc
[ 79%] Generating moc_qtluapainter.cxx
[ 80%] Generating moc_qtluaprinter.cxx
Scanning dependencies of target libqtwidget
[ 81%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/qtluapainter.cpp.o
[ 83%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/qtluaprinter.cpp.o
[ 84%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/qtlualistener.cpp.o
[ 85%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/qtwidget.cpp.o
[ 86%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/moc_qtluapainter.cxx.o
[ 87%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/moc_qtluaprinter.cxx.o
[ 89%] Building CXX object packages/qtwidget/CMakeFiles/libqtwidget.dir/moc_qtlualistener.cxx.o
Linking CXX shared module libqtwidget.so
[ 89%] Built target libqtwidget
Scanning dependencies of target libqtuiloader
[ 90%] Building CXX object packages/qtuiloader/CMakeFiles/libqtuiloader.dir/uiloader.cpp.o
Linking CXX shared module libqtuiloader.so
[ 90%] Built target libqtuiloader
[ 91%] Generating moc_qtluagui.cxx
Scanning dependencies of target libqtgui
[ 92%] Building CXX object packages/qtgui/CMakeFiles/libqtgui.dir/qtgui.cpp.o
[ 93%] Building CXX object packages/qtgui/CMakeFiles/libqtgui.dir/qtluagui.cpp.o
[ 95%] Building CXX object packages/qtgui/CMakeFiles/libqtgui.dir/moc_qtluagui.cxx.o
Linking CXX shared module libqtgui.so
[ 95%] Built target libqtgui
[ 96%] Generating moc_qtluasvggenerator.cxx
Scanning dependencies of target libqtsvg
[ 97%] Building CXX object packages/qtsvg/CMakeFiles/libqtsvg.dir/qtsvg.cpp.o
[ 98%] Building CXX object packages/qtsvg/CMakeFiles/libqtsvg.dir/qtluasvggenerator.cpp.o
[100%] Building CXX object packages/qtsvg/CMakeFiles/libqtsvg.dir/moc_qtluasvggenerator.cxx.o
Linking CXX shared module libqtsvg.so
[100%] Built target libqtsvg
cd build && make install
[ 6%] Built target libqtlua
[ 18%] Built target libqlua
[ 19%] Built target qlua
[ 20%] Built target libqtcore
[ 75%] Built target libqtide
[ 89%] Built target libqtwidget
[ 90%] Built target libqtuiloader
[ 95%] Built target libqtgui
[100%] Built target libqtsvg
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libqtlua.so
-- Set runtime path of "/usr/local/lib/libqtlua.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/include/qtlua/qtluaengine.h
-- Installing: /usr/local/include/qtlua/qtluautils.h
-- Installing: /usr/local/include/qtlua/qtluaconf.h
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/conf/cmake/QtLuaConfig.cmake
-- Installing: /usr/local/lib/libqlua.so
-- Set runtime path of "/usr/local/lib/libqlua.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/bin/qlua
-- Set runtime path of "/usr/local/bin/qlua" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtcore/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtcore.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtcore.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtide.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtide.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtide/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtide/prefs.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtide/prefs.ui
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtwidget/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtwidget.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtwidget.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtuiloader/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtuiloader/test.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtuiloader/test.ui
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtuiloader.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtuiloader.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtgui/init.lua
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtgui.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtgui.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtsvg.so
-- Set runtime path of "/usr/local/lib/luarocks/rocks/qtlua/scm-1/lib/libqtsvg.so" to "$ORIGIN/../lib:/usr/local/lib"
-- Installing: /usr/local/lib/luarocks/rocks/qtlua/scm-1/lua/qtsvg/init.lua
Warning: Directory 'doc' not found
Updating manifest for /usr/local/lib/luarocks/rocks
qtlua scm-1 is now built and installed in /usr/local/ (license: BSD)
As far as I know, lua 5.1 is the only version:
nicholas@xps:~$ th
> print(_VERSION)
Lua 5.1
[0.0001s]
> ^C^C
nicholas@xps:~$ qlua
Lua 5.1 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> print(_VERSION)
Lua 5.1
give the outputs of these commands in both th and qlua:
print(package.path)
print(package.cpath)
nicholas@xps:~$ th
> print(package.path)
/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/nicholas/.luarocks/share/lua/5.1/?.lua;/home/nicholas/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/nicholas-leonard/.luarocks/share/lua/5.1/?.lua;/home/nicholas-leonard/.luarocks/share/lua/5.1/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;./?.lua;/usr/local/share/luajit-2.0.2/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;./?.lua;/usr/local/share/luajit-2.0.2/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/home/nicholas/nikopia/?/init.lua
[0.0002s]
> print(package.cpath)
/usr/local/lib/lua/5.1/?.so;/home/nicholas/.luarocks/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;/home/nicholas-leonard/.luarocks/lib/lua/5.1/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/lib/lua/5.1/?.so
[0.0000s]
>
nicholas@xps:~$ qlua
Lua 5.1 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> print(package.path)
;/home/nicholas/nikopia/?/init.lua
> print(package.cpath)
/usr/local/lib/lua/5.1/?.so
your package.path is being initialized super wrong, as you see. I actually dont know why, and I cant reproduce your issue on Ubuntu 14.04, 14.10, RHEL 6.3, or OSX. I dont have a 12.04 machine, will see if someone else can comment.
In the meanwhile, you can start a qlua, and manually set the package.path and package.cpath to what th outputs.
Okay that worked. Thanks @soumith.
Not sure if this is related, but there isn't any difference between :
image.display{image={image.lena(), image.lena()},gui=true}
and
image.display{image={image.lena(), image.lena()},gui=false}
closing because i cannot reproduce!
have the similar problem. though reset the LUA_PATH and LUA_CPATH, it is still not working. the thing might be the path of package of torch.