Search code examples
luatorch

Installing Luarocks `cutorch` and `cunn`


Problem

I cannot install specific Luarocks. I want to determine key points in 3D hand scans using a CNN. Therefore, I want to get V2V-PoseNet running. However, I run into a problem and the researcher suggested me to try:

$luarocks install cutorch
$luarocks install cunn

Unfortunately, I get the error that I have no writing permissions. When executing with sudo, I get:

Error: No results matching query were found.

What I've tried

I have installed Torch correctly (th works) and I did a clean install of Luarocks:

$th
  ______             __   |  Torch7 / Debian 
 /_  __/__  ________/ /   |  Scientific computing for Lua. 
  / / / _ \/ __/ __/ _ \  |  Type ? for help 
 /_/  \___/_/  \__/_//_/  |  https://github.com/torch 
                          |  http://torch.ch 
th>^C^C

$sudo apt-get install luarocks

and then try to install the rocks:

$sudo luarocks install cutorch
$sudo luarocks install cunn

Without the sudo command, it is not working. The installation commands above return both Error: No results matching query were found. Someone with a similar problem was suggested to install the rock manually. If I manually download the cutorch-master, start a terminal from the folder /rocks and run

$luarocks install cutorch-1.0-0.rockspec

I get the error that my user 'does not have write permissions in /usr/local/lib/luarocks/rocks'. When I try to install with sudo, I get Missing dependencies for cutorch 1.0-0: torch >= 7.0 (not installed). I tried to modify .bashrc, but that was not successful, although I was able to repair that in the mean time.

By the way, Lua itself is installed:

$lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

Installation

I am running this from Ubuntu 18.04.

My question

How to install cutorch and cunn with Luarocks?


Solution

  • I finally found the solution. I set up Ubuntu 18.04 again and installed Torch according to the documentation.

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

    Then, I installed CUDA and ran it:

    sudo sh cuda_9.2.148_396.37_linux.run
    

    After I intalled cuDNN, I was able to run the commands above.