user3698971
user3698971

Reputation: 307

Torch / Lua after installation is not working

I have followed the following approach in order to install Torch in my machine (Mac).

http://torch.ch/docs/getting-started.html#_

When I am done with the installation, I type:

$ luarocks install image or $ luarocks lis

or $th

in order to load the th or to make updates on the lua packages. It says "command not found". Do you have any idea how I can resolve this issue?

Upvotes: 10

Views: 17116

Answers (4)

Jacob Beauchamp
Jacob Beauchamp

Reputation: 540

If you're on a Mac using the bash terminal, make sure that you've permanently added /Users/you/torch/install/bin to your PATH.

To do this:

  1. Navigate in your terminal to the root directory by running the command:

    $ cd
    
  2. Using the text editor of your choice (emacs, vim, etc.) open the .bash_profile file for editing. For example:

    $ emacs .bash_profile
    
  3. Add the following line to the end of the file (replacing 'you' with your Mac username):

    PATH=$PATH\:/Users/you/torch/install/bin ; export PATH
    
  4. Save and exit the text editor

  5. Source the changes by running:

    $ source .bash_profile
    
  6. Check that your PATH has been updated (look for /Users/you/torch/install/bin in the string returned):

    $ echo $PATH
    
  7. To make sure it has been changed permanently, completely quit Terminal, open it and run echo $PATH again

  8. Now try th and it should run Torch!


For more help on PATH: https://kb.iu.edu/d/acar

The Torch installation (at least for me) added the line . /Users/jb/torch/install/bin/torch-activate to my .profile file, not .bash_profile. I tried adding that exact line to .bash_profile but it didn't work, so based on the recommendations here I got rid of the trailing directory and such.

Upvotes: 18

rttag
rttag

Reputation: 11

I faced the same issue and following this post deleted and reinstalled everything. However in the end what helped was adding /home/user/torch/install/bin/ to the PATH variable.

Upvotes: 1

user3698971
user3698971

Reputation: 307

I have resolved the issue. I have deleted torch and I have installed it again. I have updated my PATH, and I have ran the $ luarocks install image command. After all of these, I was able to ran $ th command and in general torch.

Upvotes: 0

Ric
Ric

Reputation: 581

Have you updated your PATH? It should include something like

/home/user/torch/install/bin

Upvotes: 8

Related Questions