Search code examples
torchgoogle-colaboratory

Torch '!./install.sh' returns error in Colab when installing Torch


I followed http://torch.ch/docs/getting-started.html#_ to install Torch. I always get the following error when running

!./install.sh

in google colab

error:

...
-- Installing: /root/torch/install/include/luaT.h
-- Installing: /root/torch/install/share/cmake/torch/luaTConfig.cmake
Updating manifest for /root/torch/install/lib/luarocks/rocks
torch scm-1 is now built and installed in /root/torch/install/ (license: BSD)

Updating manifest for /root/torch/install/lib/luarocks/rocks
dok scm-1 is now built and installed in /root/torch/install/ (license: BSD)

gcc -O2 -fPIC -I/root/torch/install/include -c utils.c -o utils.o
gcc -shared -o treplutils.so -L/root/torch/install/lib utils.o
gcc -O2 -fPIC -I/root/torch/install/include -c readline.c -o readline.o
readline.c:8:10: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object readline.o

. Please I need help fixing this error.


Solution

  • Probably you need something like

    !apt-get install libreadline-dev
    

    before attempting to run the install.sh script.