Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
r-baradaran opened this issue May 1, 2018 · 12 comments
Open

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

r-baradaran opened this issue May 1, 2018 · 12 comments

Comments

@r-baradaran
Copy link

r-baradaran commented May 1, 2018

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.

@saket-maheshwary
Copy link

"luarocks install npy4th" worked for me.
@saeid6366

@adrien-jacquot
Copy link

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.

@adrien-jacquot
Copy link

@hardik2396
Copy link

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

@adrien-jacquot
Copy link

No idea, sorry

@SundeepPidugu
Copy link

SundeepPidugu commented Apr 12, 2019

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

@zhayefei
Copy link

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.

@Binathi
Copy link

Binathi commented Jul 2, 2019

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?

@Binathi
Copy link

Binathi commented Jul 2, 2019

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

@SundeepPidugu
Copy link

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

@Binathi
Copy link

Binathi commented Jul 3, 2019

Screenshot from 2019-07-03 12-22-03

@ckobus
Copy link

ckobus commented Nov 5, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants