torch / nn

Other
1.34k stars 967 forks source link

luarocks install nn fails #1214

Open mainka opened 7 years ago

mainka commented 7 years ago

Hi,

A fresh torch install on Ubuntu 16. luarocks install nn fails. Logs attached.

$ luarocks install nn
Installing https://raw.githubusercontent.com/torch/rocks/master/nn-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/nn-scm-1.rockspec... switching to 'build' mode
Cloning into 'nn'...
remote: Counting objects: 317, done.
remote: Compressing objects: 100% (276/276), done.
remote: Total 317 (delta 74), reused 140 (delta 38), pack-reused 0
Receiving objects: 100% (317/317), 597.77 KiB | 0 bytes/s, done.
Resolving deltas: 100% (74/74), done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/mainka/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/mainka/torch/install/lib/luarocks/rocks/nn/scm-1" && make

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Torch7 in /home/mainka/torch/install
-- TH_LIBRARIES: TH
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- Compiling with OpenMP support
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_nn-scm-1-8751/nn/build
Scanning dependencies of target THNN
[ 50%] Building C object lib/THNN/CMakeFiles/THNN.dir/init.c.o
In file included from /home/mainka/torch/install/include/TH/TH.h:4:0,
                 from /tmp/luarocks_nn-scm-1-8751/nn/lib/THNN/init.c:1:
/tmp/luarocks_nn-scm-1-8751/nn/lib/THNN/generic/SparseLinear.c: In function 'THNN_FloatSparseLinear_accGradParameters':
/home/mainka/torch/install/include/TH/THTensor.h:8:39: error: too many arguments to function 'THFloatTensor_sum'
 #define THTensor_(NAME)   TH_CONCAT_4(TH,Real,Tensor_,NAME)
                                       ^
/home/mainka/torch/install/include/TH/THGeneral.h:108:37: note: in definition of macro 'TH_CONCAT_4_EXPAND'
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/home/mainka/torch/install/include/TH/THTensor.h:8:27: note: in expansion of macro 'TH_CONCAT_4'
 #define THTensor_(NAME)   TH_CONCAT_4(TH,Real,Tensor_,NAME)
                           ^
/tmp/luarocks_nn-scm-1-8751/nn/lib/THNN/generic/SparseLinear.c:237:3: note: in expansion of macro 'THTensor_'
   THTensor_(sum)(buf, gradOutput, 0, 1);
   ^
/home/mainka/torch/install/include/TH/THTensor.h:8:39: note: declared here
 #define THTensor_(NAME)   TH_CONCAT_4(TH,Real,Tensor_,NAME)
                                       ^
/home/mainka/torch/install/include/TH/THGeneral.h:108:37: note: in definition of macro 'TH_CONCAT_4_EXPAND'
 #define TH_CONCAT_4_EXPAND(x,y,z,w) x ## y ## z ## w
                                     ^
/home/mainka/torch/install/include/TH/THTensor.h:8:27: note: in expansion of macro 'TH_CONCAT_4'
 #define THTensor_(NAME)   TH_CONCAT_4(TH,Real,Tensor_,NAME)
                           ^
/home/mainka/torch/install/include/TH/generic/THTensorMath.h:77:13: note: in expansion of macro 'THTensor_'
 TH_API void THTensor_(sum)(THTensor *r_, THTensor *t, int dimension);
tastyminerals commented 7 years ago

Confirming, tried to run experiments today after reinstalling torch. Same issue.

gchanan commented 7 years ago

"luarocks install torch" followed by "luarocks install nn" works for me.

mainka commented 7 years ago

I followed the procedure described in http://torch.ch/docs/getting-started.html

# in a terminal, run the commands WITHOUT sudo
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

I confirm that doing luarocks install torch && luarocks install nn afterwards, everything works. Maybe it should be documented somewhere?

ddurham2 commented 7 years ago

I get the same error. Linux Mint 18 which is based on Ubuntu 16.04 LTS. But the error is against code that luarocks downloaded o_O.

@mainka Are you saying that after doing that first step of cloning from git, building and installing, and THEN doing a luarocks install of torch was the key? If so, that seems to imply that version of torch from git is not compatible with the version of nn from luarocks.

ddurham2 commented 7 years ago

This worked for me too. I guess the nn project has some work to do getting it compatible with the HEAD of torch.

nicholas-leonard commented 7 years ago

working on this.

ShowLang commented 7 years ago

luarocks install torch && luarocks install nn

SeekPoint commented 7 years ago

it works for me

rabinandan commented 6 years ago

May be luarocks install torch && luarocks install nn work. I am also getting error in luarocks install nn but error code is different Installing https://luarocks.org/nn-1.0.4-1.src.rock gcc -O2 -fPIC -I/usr/include/lua5.2 -c lnn.c -o lnn.o lnn.c:4:23: fatal error: nanomsg/nn.h: No such file or directory

include<nanomsg/nn.h>

                   ^

compilation terminated.

Error: Build error: Failed compiling object lnn.o

shamimsareem commented 5 years ago

shamin@shamin-System-Product-Name:~$ luarocks install torch

Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks -- you may want to run as a privileged user or use your local tree with --local. shamin@shamin-System-Product-Name:~$ Whats wrong here?

shamimsareem commented 5 years ago

I want to install nn to use as dependence of lua and torch code.

SeekPoint commented 5 years ago

since pytorch coming, we don't need torch anymore, bye!