Torch7: th command not working after clean install on ubuntu 16

Created on 23 Feb 2017  ·  14Comments  ·  Source: torch/torch7

Neither luajit nor lua found in path on ubuntu after clean install
this is when I ran ./test.sh

I followed official instructions as indicated on the website

Most helpful comment

we install our own luarocks.
Before running ./test.sh, one has to run:

. ~/torch/install/bin/torch-activate

All 14 comments

Had a brief discussion with the user, at the least luarocks package was missing from install-deps

we install our own luarocks.
Before running ./test.sh, one has to run:

. ~/torch/install/bin/torch-activate

so I have manually added lua to my environment path , and it is accessible now from terminal but I cant seem to install luarocks by following instructions from https://luarocks.org/#quick-start

The screenshot shows torch install success after removing torch directory and trying again

image

Since torch is doing a local install, it has to be added to your path to work. To do so, run ~/torch/install/bin/torch-activate (and add it to your bashrc).

I tried that , I am getting this error
saurabhorange@orangepc:~/torch$ ~/torch/install/bin/torch-activate
bash: /home/saurabhorange/torch/install/bin/torch-activate: No such file or directory

You did run ./install.sh after running bash install-deps right? (see full innstructions here)

Yes I did , I copied those 3 lines of code line by line
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

the ./install.sh command should have created a install folder in ~/torch and you should find both th and luearocks in the bin folder at ~/torch/install/bin

unfortunately it didnt create an install folder , thats the main problem , I have tried reinstalling it multiple times , here is how folder looks
image

What happens when you open this folder in a terminal and run ./install.sh ?

I opened the folder in this terminal and tried running install.sh , and I saw some new commands executing ( one I didnt observe before when I copy pasted those 3 installanation commands into terminal from official docs ) and it failed because of connection timeout error of github rep ( something related to xlua) , then I ran ./clean.sh and reran ./install.sh , This time it went all green and even asked me if I wanted to add path in bashrc file , I typed yes and restarted and it works!
Thanks for the help everyone :)

image

same problem, sad that nobody found a solution here.............

@wgallo3
Adding /Users/USERNAME/torch/install/bin to PATH after Torch installation worked for me so maybe you can try:

  1. Check your current PATH in terminal:
    echo $PATH
  2. If there is no 'torch path' then you need to add it to your .bash_profile (or other shell initialization file you are using) :
    nano ~/.bash_profile
  3. Add this to .bash_profile (replacing USERNAME with your user name):
#Adding Torch directory to PATH
export PATH="/Users/USERNAME/torch/install/bin:$PATH”
  1. Press CTRL-X for exit, then Y for saving, then RETURN to confirm.
  2. Restart terminal
  3. Check your PATH again:
    echo $PATH

If everything went ok you should be able to start: torch-activate, th, luajit, luarocks from terminal.

Note: .bash_profile will run only on login shells. For non-login shells, you would need to create/edit a .bashrc

When I installed Torch, it added to .bashrc:

. /home/localadmin/torch/install/bin/torch-activate

Running this command in bash (or running source ~/.bashrc) gives me access to th again.

The terminal that you used when you installed Torch should contain a similar line, and sourcing the given config file should give you access to the th command again. Some possible relevant config files:

# On Linux with bash
source ~/.bashrc
# On Linux with zsh
source ~/.zshrc
# On OSX or in Linux with none of the above.
source ~/.profile
Was this page helpful?
0 / 5 - 0 ratings