char-rnn icon indicating copy to clipboard operation
char-rnn copied to clipboard

Problem with Torch

Open jmsellier opened this issue 9 years ago • 25 comments

Hello Everyone,

I tried to run char-rnn on my computer but I have a strange problem. First of all, I tried to install Torch by following the instructions on their website:

sudo curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-all | bash

Despite I am using "sudo", at some point (after a lot of downloading and compiling) the installation script (or whatever it was) complained about having not enough permission to install and got stuck. I stoped it manually and since I could still access Torch by typing:

luajit -ltorch

I thought everything was all right. But now, if I do:

luajit -ltorch train.lua -gpuid -1

this is what I get:

luajit: ./util/CharSplitLMMinibatchLoader.lua:14: attempt to index global 'path' (a nil value) stack traceback: ./util/CharSplitLMMinibatchLoader.lua:14: in function 'create' train.lua:110: in main chunk [C]: at 0x0804c9e0

Since I am no expert of LUA, I have no idea how to proceed. Can someone help me?

MANY thanks in advance!!

JM

jmsellier avatar Aug 18 '15 05:08 jmsellier

Have you tried using the command th rather than luajit?

This error almost certainly means that you somehow haven't followed the instructions for installing Torch in full: http://torch.ch/docs/getting-started.html#_

karpathy avatar Aug 18 '15 10:08 karpathy

Yes, I tried and it tells me that the command th does not exist.

jmsellier avatar Aug 18 '15 10:08 jmsellier

hey @jmsellier that command you quoted does not appear anywhere on our website. We never recommend "sudo" when installing torch at the moment.

I suggest you clean up the installation using this script: https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh

After that, if you use the instructions on our website, you should be okay.

soumith avatar Aug 18 '15 12:08 soumith

Thanks for your help!

I utilized your clean-old script and then I followed the instructions on this page:

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

I had no problem with running the following commands:

curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash git clone https://github.com/torch/distro.git ~/torch --recursive

But when I did:

cd ~/torch; ./install.sh

I got a lot of stuff and then the following error/message (final part):

... CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_pow': buildvm_x86.dasc:(.text+0x28e5): undefined reference tolj_wrap_pow' CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_atan2': buildvm_x86.dasc:(.text+0x2929): undefined reference tolj_wrap_atan2' CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_fmod': buildvm_x86.dasc:(.text+0x296d): undefined reference tolj_wrap_fmod' collect2: error: ld returned 1 exit status make[2]: *** [exe/luajit-rocks/luajit-2.1/luajit] Error 1 make[1]: *** [exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit.dir/all] Error 2 make: *** [all] Error 2 ./install.sh: line 67: /home/sellier/torch/install/bin/luarocks: No such file or directory Installing common Lua packages ./install.sh: line 71: /home/sellier/torch/install/bin/luarocks: No such file or directory ./install.sh: line 72: /home/sellier/torch/install/bin/luarocks: No such file or directory ./install.sh: line 73: /home/sellier/torch/install/bin/luarocks: No such file or directory Installing core Torch packages ./install.sh: line 76: /home/sellier/torch/install/bin/luarocks: No such file or directory

Any idea on how to fix it? Am I doing something wrong?

Thanks!

jmsellier avatar Aug 18 '15 13:08 jmsellier

@jmsellier I think you are running this in a virtual machine. Can you use this command for install:

TORCH_LUA_VERSION=LUAJIT20 ./install.sh

soumith avatar Aug 18 '15 14:08 soumith

I tried your suggestion but it did not work.. and, yes, I am trying to install it in a virtual machine. Do you think this could be the problem?

jmsellier avatar Aug 18 '15 14:08 jmsellier

Before I can try the suggestion above I still need torch to be installed on my virtual machine (many thanks anyway). I tried the following new things:

TORCH_LUA_VERSION=LUAJIT20 ./install.sh TORCH_LUA_VERSION=LUAJIT21 ./install.sh TORCH_LUA_VERSION=LUAJIT51 ./install.sh TORCH_LUA_VERSION=LUAJIT52 ./install.sh

and every time I get the following message:

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

gcc -O2 -fPIC -I/home/sellier/torch/install/include -c readline.c -o readline.o readline.c:7:31: fatal error: readline/readline.h: No such file or directory compilation terminated.

Error: Build error: Failed compiling object readline.o

Any clue? MANY thanks!

jmsellier avatar Sep 11 '15 08:09 jmsellier

install readline headers? On redhat, this is readline-devel, and on ubuntu it is libreadline-dev , I think.

hughperkins avatar Sep 11 '15 10:09 hughperkins

Odd though, normally this is installed by install.sh. I reckon you shoud provide the full install.sh output. Actually, last time this happened, I think it was missing gfortran.

hughperkins avatar Sep 11 '15 10:09 hughperkins

I installed the libreadline-dev library and things have improved. Now I can proceed further although at the end I still have an error. Please find it below:

Install the project... -- Install configuration: "Release" -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lib/libsignal.so -- Set runtime path of "/home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lib/libsignal.so" to "$ORIGIN/../lib:/home/sellier/torch/install/lib" -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/extramath.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/complex.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/convolution.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/init.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/wavelet.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/fft.lua -- Installing: /home/sellier/torch/install/lib/luarocks/rocks/signal/scm-1/lua/signal/ffi.lua Updating manifest for /home/sellier/torch/install/lib/luarocks/rocks signal scm-1 is now built and installed in /home/sellier/torch/install/ (license: RWTFPL)

Missing dependencies for itorch: lbase64 luacrypto uuid lzmq >= 0.4.2

Using https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/lbase64-20120820-1.src.rock... switching to 'build' mode Do not use 'module' as a build type. Use 'builtin' instead. gcc -O2 -fPIC -I/home/sellier/torch/install/include -c lbase64.c -o lbase64.o gcc -shared -o base64.so -L/home/sellier/torch/install/lib lbase64.o Updating manifest for /home/sellier/torch/install/lib/luarocks/rocks lbase64 20120820-1 is now built and installed in /home/sellier/torch/install/ (license: Public domain)

Using https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luacrypto-0.3.2-1.src.rock... switching to 'build' mode

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/luacrypto-0.3.2-1.src.rock - Could not find expected file openssl/evp.h, or openssl/evp.h for OPENSSL -- you may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command. Example: luarocks install luacrypto OPENSSL_DIR=/usr/local

Many many thanks for helping!

jmsellier avatar Sep 11 '15 11:09 jmsellier

well, I reckon you're missing libssl-dev ;-)

hughperkins avatar Sep 11 '15 11:09 hughperkins

Question: did you first run https://raw.githubusercontent.com/torch/ezinstall/master/install-deps ?

wget https://raw.githubusercontent.com/torch/ezinstall/master/install-deps
bash install-deps

(Edit: hmmm, seems that install-deps doesnt actually install libssl-dev, at least not directly anyway)

hughperkins avatar Sep 11 '15 11:09 hughperkins

I installed openssl and then I ran the install-deps script but no luck.. I still get the same error..

jmsellier avatar Sep 12 '15 09:09 jmsellier

did you install libssl-dev? ie, sudo apt-get install -y libssl-dev ?

hughperkins avatar Sep 12 '15 09:09 hughperkins

I installed libssl-dev and libzmq. I now get a different error:

gcc -O2 -fPIC -I/home/sellier/torch/install/include -c src/lzmq.c -o src/lzmq.o -DLUAZMQ_USE_SEND_AS_BUF -DLUAZMQ_USE_TEMP_BUFFERS -DLUAZMQ_USE_ERR_TYPE_OBJECT -I/usr/include src/lzmq.c:483:1: error: ‘ZMQ_EVENT_CONNECTED’ undeclared here (not in a function) src/lzmq.c:484:1: error: ‘ZMQ_EVENT_CONNECT_DELAYED’ undeclared here (not in a function) src/lzmq.c:485:1: error: ‘ZMQ_EVENT_CONNECT_RETRIED’ undeclared here (not in a function) src/lzmq.c:487:1: error: ‘ZMQ_EVENT_LISTENING’ undeclared here (not in a function) src/lzmq.c:488:1: error: ‘ZMQ_EVENT_BIND_FAILED’ undeclared here (not in a function) src/lzmq.c:490:1: error: ‘ZMQ_EVENT_ACCEPTED’ undeclared here (not in a function) src/lzmq.c:491:1: error: ‘ZMQ_EVENT_ACCEPT_FAILED’ undeclared here (not in a function) src/lzmq.c:493:1: error: ‘ZMQ_EVENT_CLOSED’ undeclared here (not in a function) src/lzmq.c:494:1: error: ‘ZMQ_EVENT_CLOSE_FAILED’ undeclared here (not in a function) src/lzmq.c:495:1: error: ‘ZMQ_EVENT_DISCONNECTED’ undeclared here (not in a function) src/lzmq.c:500:1: error: ‘ZMQ_EVENT_ALL’ undeclared here (not in a function)

Error: Failed installing dependency: https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/lzmq-0.4.3-1.src.rock - Build error: Failed compiling object src/lzmq.o

MANY thanks for helping!

jmsellier avatar Sep 12 '15 09:09 jmsellier

I reckon you are missing a bunch of dependencies. Also, I think you used an out of date installation script initially. Can you try:

  • rename ~/torch to ~/torch.old
  • install torch using the instructions at http://github.com/torch/distro

(In the specific though, I guess you'r emissing lzmq development libraries, but it seems you are misisng tons of libraries...; by the way what OS are you using?)

hughperkins avatar Sep 12 '15 09:09 hughperkins

I have used the instructions in that link too and it did not work. I am running Xubuntu in a virtual machine. If this represents a problem, I will use a native GNU/Linux machine then.. Anyway, thanks for your help!

jmsellier avatar Sep 12 '15 09:09 jmsellier

Hmmm, well, I'm using xubuntu too :-) though not in a vm. However, my installation path was:

  • first installed standard ubuntu 14.04
  • then installed xfce4-[something]
  • ... therefore I already had a bunch of ubuntu libraries installed

I reckon the path of least resistance would be:

  • either install ubuntu desktop eg sudo apt-get install ubuntu-desktop, or
  • install a vm

If it was me though, I'd probably just install the development libraries as each bug comes up. The development libraries all end in -dev, and often start in lib, eg you can type sudo apt-get install libzmq then hit the [tab] key, and up will pop some choices. Choose the one ending in -dev and you might be good. (In the specific though, I notice that on my machine I have libzmq3-dev, so you might need to try different version numbers :-P

I'm tempted to provide a list of the versions of libraries I have, but I reckon that's a security risk, but if you have some way for me to communicate that privately I can send that to you.

hughperkins avatar Sep 12 '15 10:09 hughperkins

I will try on a native GNU/Linux machine with a more updated O.S. to see how it goes.. It seems that the virtual machine is complicating everything.. Thanks guys for your help anyway!

jmsellier avatar Sep 14 '15 06:09 jmsellier

Ok. I reckon once you've figured it out on the native GNU/Linux machine (I assume you mean Ubuntu 14.04 by the way? This is the most standard torch distrib currently, AFAIK), then it will be fairly easy to get it working in Xubuntu VM too.

hughperkins avatar Sep 14 '15 11:09 hughperkins

You can also try in a Docker container by the way, eg see https://hub.docker.com/r/hughperkins/cltorch-nvidia/ You'd need to either modify the Dockerfile to also install char-rnn, or else add char-rnn after starting the container. There's some torch containers created by kaixhin https://hub.docker.com/u/kaixhin/

hughperkins avatar Nov 15 '15 09:11 hughperkins

Seems like this issue is really old and can be closed?

hughperkins avatar Dec 25 '15 03:12 hughperkins

Yes it can be closed. Thanks.

2015-12-25 4:56 GMT+01:00 Hugh Perkins [email protected]:

Seems like this issue is really old and can be closed?

— Reply to this email directly or view it on GitHub https://github.com/karpathy/char-rnn/issues/86#issuecomment-167189626.

Jean Michel Sellier, Ph.D., M.Sc.

www.nano-archimedes.com

www.gnu.org/software/archimedes

www.gnu.org/software/nano-archimedes

http://en.wikipedia.org/wiki/GNU_Archimedes

http://www.dice-library.org

jmsellier avatar Dec 25 '15 10:12 jmsellier

Hi, I am trying to install iTorch, luacrypto is a dependency which I am not able to satisfy. The moonrock repositories are not accessible from my office. Can you suggest me a place from where I can download luacrypto?

The sources I have found till now either do not have a makefile or do not have a rockpec to use luarocks build luacrypto-git-1.rockspec. I installed image, moses, lzmq, lbase and uuid either through rockspec or src.rockspec

Thanks for the help

adipiratla1987 avatar Sep 22 '17 05:09 adipiratla1987

root@node2610:/data/devdata/gl/paper/package/distro-master# ./install.sh Prefix set to /data/devdata/gl/paper/package/distro-master/install fatal: Not a git repository (or any parent up to mount point /data) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set). Installing Lua version: LUAJIT21 CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "/usr/bin/cc" is not able to compile a simple test program.

It fails with the following output:

Change Dir: /data/devdata/gl/paper/package/distro-master/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_33725/fast"

/usr/bin/make -f CMakeFiles/cmTC_33725.dir/build.make CMakeFiles/cmTC_33725.dir/build

make[1]: Entering directory '/data/devdata/gl/paper/package/distro-master/build/CMakeFiles/CMakeTmp'

Building C object CMakeFiles/cmTC_33725.dir/testCCompiler.c.o

/usr/bin/cc -o CMakeFiles/cmTC_33725.dir/testCCompiler.c.o -c /data/devdata/gl/paper/package/distro-master/build/CMakeFiles/CMakeTmp/testCCompiler.c

cc: error trying to exec 'cc1': execvp: 没有那个文件或目录

CMakeFiles/cmTC_33725.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_33725.dir/testCCompiler.c.o' failed

make[1]: *** [CMakeFiles/cmTC_33725.dir/testCCompiler.c.o] Error 1

make[1]: Leaving directory '/data/devdata/gl/paper/package/distro-master/build/CMakeFiles/CMakeTmp'

Makefile:126: recipe for target 'cmTC_33725/fast' failed

make: *** [cmTC_33725/fast] Error 2

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt

how to solve it? I am offline.

gaoliang13 avatar May 15 '18 02:05 gaoliang13