Skip to content

Instantly share code, notes, and snippets.

@gupta-abhay
Last active February 1, 2016 07:22
Show Gist options
  • Save gupta-abhay/3de0e05ba4d65e6cd475 to your computer and use it in GitHub Desktop.
Save gupta-abhay/3de0e05ba4d65e6cd475 to your computer and use it in GitHub Desktop.
The dependency error for nn: 'luaffi' error debug

#Dependency Bug Fix for nn package torch

(Note: This is the bug-fix i could found. If you find an easier way, please let me know in the comments below.)

During installation of torch on your computer or the GPU, you may possibly encounter a bug similar to this one:

Dependency missing for nn:
luaffi

Installing https://raw.githubusercontent.com/torch/rocks/master/luaffi-scm-1.rockspec ... switching to build mode

fatal error: unable to access 'https://raw.githubusercontent.com/torch/rocks/master/luaffi-scm-1.rockspec'
github.com: Could not resolve host 'github.com'

Installation failed

To fix the bug

  • Perform a clean by running sh clean.sh
  • If you run into Permission denied errors then, use sudo sh clean.sh, but necesarily make sure the previous installation is cleaned
  • Switch directories cd ~/torch/extra/luaffib and then run ~/torch/install/bin/luarocks make
  • Again if you face Permission denied error, then run sudo ~/torch/install/bin/luarocks make
  • The main resaon for using ~/torch/install/bin/ is because:
    • LuaJIT21 is installed in the first step of the build process
    • It is built directly into /usr/local/lib/luarocks
    • If ~/torch/install/bin/luarocks is not specified, the build is lost to the torch install.sh file
  • After doing this, go to ~/torch/install/lib/luarocks/rocks and check if the folder luaffi is built.
    • If yes, you are covered and can perform a clean install.
    • Else, run sudo sh clean.sh again in the base torch folder and re-build it.
  • Now, switch to ~/torch/ and then run install.sh once again.

Remember to run sudo ~/.bashrc or sudo ~/.profile for refreshing your environment variables.

Now, run th and you should get a display like the one shown here.

Congratulations!!! You have successfully installed Torch.

@sakethrambhatla
Copy link

@gupta-abhay
There is no file or directory luaffib in ~/torch/extra. There is a folder luaffifb.
After running clean.sh, the directory install will be removed right? How can we run ~/torch/install/bin/luarocks make?
Thanks and Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment