karpathy / char-rnn

Multi-layer Recurrent Neural Networks (LSTM, GRU, RNN) for character-level language models in Torch
11.52k stars 2.58k forks source link

th: command not found #209

Closed ilikealotgithub1234 closed 6 years ago

ilikealotgithub1234 commented 6 years ago

This is a pretty basic seeming problem but its baffled me for quite some time. Once I install all of the software from the directions and get to the first test thingy, I get the error: th: command not found. This is also confusing since under ~/torch/install/bin you can clearly see th.

erik@erik-ubnub: ~/torch/install/bin$ ls
json2lua lua2json luajit luarocks luarocks-admin mdcat th torch-activate

If it matters I'm also using Ubuntu Desktop 17.10. `

pietrocalzini commented 6 years ago

Try to have a look at this link that explains how to install torch Here.

The installation script adds torch to your PATH variable. You just have to source it once to refresh your env variables.

You can try to do this in the directory you want to run torch from:

#On Linux with bash

source ~/.bashrc

#On Linux with zsh

source ~/.zshrc

#On OSX or in Linux with none of the above.

source ~/.profile
ilikealotgithub1234 commented 6 years ago

upon running ./install.sh i get this message. When th is run I get the same message. Should I uninstall everything with rm -rf ~/torch because something is interfering with torch from the initial download?

home/erik/torch/pkg/paths/paths.c:1012:20: note: each undeclared identifier is reported only once for each function it appears in
CMakeFiles/Makerfile2:67: recipe for target 'CMakeFiles/paths.dir/all' failed
make[1]:  *** [CMakeFiles/paths,dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Error: Build error: Failed building.
pietrocalzini commented 6 years ago

I would suggest to try to run rm -rf ~/torch and try to follow the instructions in this page again. If you get error in the installation, post your errors here.

ilikealotgithub1234 commented 6 years ago

I have reinstalled it. The good news is that when I run th by itself it is run and I get the Torch logo and about information. Then I cloned this repository into my home directory. But when I run the test code th train.lua -gpuid -1, I get an error: /home/erik/torch/install/bin/luajit: cannot open train.lua: No such file or directory. Should train.lua be in this directory for it to work?

pietrocalzini commented 6 years ago

Yes, when calling th train.lua -gpuid -1 you must be in the directory containing train.lua.

ilikealotgithub1234 commented 6 years ago

Thanks! This works perfectly. The code works when I run it in the char-rnn-master directory. Closing this issue.

BadCoder2 commented 5 years ago

I'm getting the same issue of Command th not found, even though torch was downloaded fine with no errors. When I run source ~/.profile, I get No such file or directory.

pdeperth commented 5 years ago

Same for me

AlekzNet commented 5 years ago

When I run source ~/.profile, I get No such file or directory.

Probably there is no .profile in your home directory? If you installed torch in $HOME/torch you can try this command:

export PATH=$PATH:$HOME/torch/install/bin
ast1997 commented 4 years ago

I would suggest to try to run rm -rf ~/torch and try to follow the instructions in this page again. If you get error in the installation, post your errors here.

I got this error E: Package 'python-software-properties' has no installation candidate

ast1997 commented 4 years ago

Try to have a look at this link that explains how to install torch Here.

The installation script adds torch to your PATH variable. You just have to source it once to refresh your env variables.

You can try to do this in the directory you want to run torch from:

#On Linux with bash

source ~/.bashrc

#On Linux with zsh

source ~/.zshrc

#On OSX or in Linux with none of the above.

source ~/.profile

@pietrocalzini I got error E: Package 'python-software-properties' has no installation candidate while following those steps

AlexRMU commented 4 years ago

Hard but easy

Clone the Torch repo (forked to work with CUDA 10).

!git clone https://github.com/nagadomi/distro.git torch --recursive

Install Torch.

import os
os.chdir('./torch/')
!bash install-deps
!./install.sh

Activate Torch.

!. ./install/bin/torch-activate

Make sure the installation worked.

!./install/bin/th

Result:

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

th> ^C