在iTorch
中我运行了一段代码require nn
时,我在Jupyter中遇到以下错误:
[string "require 'nn'..."]:1: module 'nn' not found:
no field package.preload['nn']
no file '/usr/local/share/lua/5.2/nn.lua'
no file '/usr/local/share/lua/5.2/nn/init.lua'
no file '/usr/local/lib/lua/5.2/nn.lua'
no file '/usr/local/lib/lua/5.2/nn/init.lua'
no file './nn.lua'
no file '/usr/local/lib/lua/5.2/nn.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './nn.so'
stack traceback:
/usr/local/share/lua/5.2/itorch/main.lua:166: in function </usr/local/share/lua/5.2/itorch/main.lua:159>
[C]: in function 'require'
[string "require 'nn'..."]:1: in main chunk
[C]: in function 'xpcall'
/usr/local/share/lua/5.2/itorch/main.lua:209: in function </usr/local/share/lua/5.2/itorch/main.lua:173>
(...tail calls...)
/usr/local/share/lua/5.2/lzmq/poller.lua:75: in function 'poll'
/usr/local/share/lua/5.2/lzmq/impl/loop.lua:307: in function 'poll'
/usr/local/share/lua/5.2/lzmq/impl/loop.lua:325: in function 'sleep_ex'
/usr/local/share/lua/5.2/lzmq/impl/loop.lua:370: in function 'start'
/usr/local/share/lua/5.2/itorch/main.lua:381: in main chunk
[C]: in function 'require'
(command line):1: in main chunk
[C]: in ?
似乎没有正确安装神经网络包。当我使用命令sudo luarocks install --server=http://luarocks.org/dev nn
重新安装nn包时,出现以下错误:
Installing http://luarocks.org/dev/nn-scm-1.rockspec...
Using http://luarocks.org/dev/nn-scm-1.rockspec... switching to 'build' mode
Cloning into 'lua-nn'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 3 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), done.
Checking connectivity... done.
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/include -c lnn.c -o lnn.o
lnn.c:4:9: fatal error: 'nanomsg/nn.h' file not found
#include<nanomsg/nn.h>
^
1 error generated.
Error: Build error: Failed compiling object lnn.o
我该如何解决这个问题?
答案 0 :(得分:6)
在我的情况下,我用sudo gem install jekyll
安装了lua,因此使用了错误的luarocks。它在使用brew
之后起作用。
我在这里找到了我的解决方案:https://groups.google.com/forum/#!msg/torch7/IRDxGaYYV9Q/u3V9XeVHOwAJ