xinyadu / nqg

neural question generation for reading comprehension

Home Page:https://arxiv.org/abs/1705.00106

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can i fix errors when run "th convert.lua"?

r-baradaran opened this issue · comments

Hello!
When i run this code received followed error:
"th convert.lua"

/ home/my/torch/install/bin/lua: /home/my/torch/install/share/lua/5.2/trepl/init.lua:389: module 'npy4th' not found:No LuaRocks module found for npy4th
no field package.preload['npy4th']
no file '/home/my/.luarocks/share/lua/5.2/npy4th.lua'
no file '/home/my/.luarocks/share/lua/5.2/npy4th/init.lua'
no file '/home/my/torch/install/share/lua/5.2/npy4th.lua'
no file '/home/my/torch/install/share/lua/5.2/npy4th/init.lua'
no file '/home/my/code/torch/install/share/lua/5.2/npy4th.lua'
no file '/home/my/code/torch/install/share/lua/5.2/npy4th/init.lua'
no file '/home/my/code/torch/install/lib/lua/5.2/npy4th.lua'
no file '/home/my/code/torch/install/lib/lua/5.2/npy4th/init.lua'
no file './npy4th.lua'
no file '/home/my/.luarocks/lib/lua/5.2/npy4th.so'
no file '/home/my/torch/install/lib/lua/5.2/npy4th.so'
no file '/home/my/torch/install/lib/npy4th.so'
no file '/home/my/code/torch/install/lib/npy4th.so'
no file '/home/my/code/.luarocks/lib/lua/5.2/npy4th.so'
no file '/home/my/code/torch/install/lib/lua/5.2/npy4th.so'
no file '/home/my/code/torch/install/lib/lua/5.2/loadall.so'
no file './npy4th.so'
stack traceback:
[C]: in function 'error'
/home/my/torch/install/share/lua/5.2/trepl/init.lua:389: in function 'require'
convert.lua:1: in main chunk
[C]: in function 'dofile'
...aran/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: in ?

Also i try to setup npy4th by this commands:
"git clone https://github.com/htwaijry/npy4th.git
cd npy4th
luarocks make"

but receive these errors:

cmake -E make_directory build;
cd build;
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/my/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/my/torch/install/lib/luarocks/rocks/npy4th/1.3-3";
make

"-- Found Torch7 in /home/my/torch/install
-- Configuring done
-- Generating done
-- Build files have been written to: /home/my/npy4th/build
[ 50%] Built target cnpy
[ 75%] Building CXX object CMakeFiles/npy4th.dir/npy4th.cpp.o
/home/my/npy4th/npy4th.cpp: In function ‘void load_array_to_lua(lua_State*, cnpy::NpyArray&)’:
/home/my/npy4th/npy4th.cpp:37:33: warning: ‘const char* luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.FloatTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:37:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.FloatTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:37:77: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.FloatTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:43:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.DoubleTensor"))
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:43:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.DoubleTensor"))
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:43:78: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.DoubleTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:50:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ByteTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:50:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ByteTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:50:76: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ByteTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:56:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ShortTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:56:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ShortTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:56:77: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.ShortTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:62:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.IntTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:62:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.IntTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:62:75: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.IntTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:68:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.LongTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:68:33: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.LongTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp:68:76: warning: ‘const char
luaT_checktypename2id(lua_State*, const char*)’ is deprecated [-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.LongTensor"));
^
In file included from /home/my/npy4th/npy4th.cpp:12:0:
/home/my/torch/install/include/luaT.h:132:38: note: declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State L, const
^
/home/my/npy4th/npy4th.cpp: At global scope:
/home/my/npy4th/npy4th.cpp:213:1: error: elements of array ‘const luaL_reg npyth []’ have incomplete type
};
^
/home/my/npy4th/npy4th.cpp:213:1: error: storage size of ‘npyth’ isn’t known
/home/my/npy4th/npy4th.cpp: In function ‘int luaopen_libnpy4th(lua_State
)’:
/home/my/npy4th/npy4th.cpp:216:40: error: ‘luaL_openlib’ was not declared in this scope
luaL_openlib(L, "libnpy4th", npyth, 0);
^
CMakeFiles/npy4th.dir/build.make:62: recipe for target 'CMakeFiles/npy4th.dir/npy4th.cpp.o' failed
make[2]: *** [CMakeFiles/npy4th.dir/npy4th.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/npy4th.dir/all' failed
make[1]: *** [CMakeFiles/npy4th.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Error: Build error: Failed building."

How can I fix it and run this model?
Please help me.
Thanks very much.

"luarocks install npy4th" worked for me.
@saeid6366

Facing the same issue, I tried both building npy4th from source and installing with luarocks:
Method 1
git clone https://github.com/htwaijry/npy4th.git
cd npy4th
luarocks make

Method 2
luarocks install npy4th

Getting this error:

/tmp/luarocks_npy4th-1.3-3-1149/npy4th/npy4th.cpp:213:1: error: elements of array ‘const luaL_reg npyth []’ have incomplete type
};
^
/tmp/luarocks_npy4th-1.3-3-1149/npy4th/npy4th.cpp:213:1: error: storage size of ‘npyth’ isn’t known
/tmp/luarocks_npy4th-1.3-3-1149/npy4th/npy4th.cpp: In function ‘int luaopen_libnpy4th(lua_State*)’:
/tmp/luarocks_npy4th-1.3-3-1149/npy4th/npy4th.cpp:216:40: error: ‘luaL_openlib’ was not declared in this scope
luaL_openlib(L, "libnpy4th", npyth, 0);
^
make[2]: *** [CMakeFiles/npy4th.dir/npy4th.cpp.o] Error 1
make[1]: *** [CMakeFiles/npy4th.dir/all] Error 2
make: *** [all] Error 2

Error: Build error: Failed building.

How to solve this if you are not using AWS?
@adrien-jacquot

No idea, sorry

How do i fix this when running th convert.lua

 at /tmp/luarocks_npy4th-1.3-3-5494/npy4th/npy4th.cpp:94
stack traceback:
        [C]: in function 'loadnpy'
        convert.lua:22: in main chunk
        [C]: in function 'dofile'
        ...y172/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x55674668b570

try reinstall torch ref: http://torch.ch/docs/getting-started.html

git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh
source ~/.bashrc
then:
luarocks install npy4th
luarocks install tds

God bless you.

How do i fix this when running th convert.lua

 at /tmp/luarocks_npy4th-1.3-3-5494/npy4th/npy4th.cpp:94
stack traceback:
        [C]: in function 'loadnpy'
        convert.lua:22: in main chunk
        [C]: in function 'dofile'
        ...y172/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x55674668b570

did you find any fix?

How do i fix this when running th convert.lua

 at /tmp/luarocks_npy4th-1.3-3-5494/npy4th/npy4th.cpp:94
stack traceback:
        [C]: in function 'loadnpy'
        convert.lua:22: in main chunk
        [C]: in function 'dofile'
        ...y172/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x55674668b570

did you find any fix?

Needed to change the path of .t7 file in torch.save command in convert.lua file.
Issue resolved

How do i fix this when running th convert.lua

 at /tmp/luarocks_npy4th-1.3-3-5494/npy4th/npy4th.cpp:94
stack traceback:
        [C]: in function 'loadnpy'
        convert.lua:22: in main chunk
        [C]: in function 'dofile'
        ...y172/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
        [C]: at 0x55674668b570

did you find any fix?

Needed to change the path of .t7 file in torch.save command in convert.lua file.
Issue resolved

Please attach a PR for the same

commented

Hi,

I also have issue launching 'th convert.lua'; I got the following message '/usr/bin/luajit: /usr/share/lua/5.1/trepl/init.lua:389: module 'npy4th' not found:'
Then, I try 'sudo luarocks install npy4th' and got:

'Missing dependencies for npy4th 1.3-3:
xlua >= 1.0 (not installed)

npy4th 1.3-3 depends on xlua >= 1.0 (not installed)

Error: Could not satisfy dependency xlua >= 1.0: No results matching query were found. '

Do you know how to handle that?

Thanks!