Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require('cutorch') does not work #210

Closed
tuming1990 opened this issue Jul 28, 2015 · 27 comments
Closed

require('cutorch') does not work #210

tuming1990 opened this issue Jul 28, 2015 · 27 comments

Comments

@tuming1990
Copy link

Hi,

My system is MAC OS 10.10.4

I installed cutorch and cunn using "luarocks install cutorch/cunn". There was no error during this process and at the end it showed that cutorch/cunn is installed in ....

But when I call require('cutorch/cunn'), it gives the error:
/usr/local/share/lua/5.1/trepl/init.lua:363: /usr/local/share/lua/5.1/trepl/init.lua:363: /usr/local/share/lua/5.1/cutorch/init.lua:2: cannot load '/usr/local/lib/lua/5.1/libcutorch.so'
stack traceback:
[C]: in function 'error'
/usr/local/share/lua/5.1/trepl/init.lua:363: in function 'require'
[string "_RESULT={require('cunn')}"]:1: in main chunk
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/trepl/init.lua:630: in function 'repl'
/usr/local/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
[C]: at 0x0107d8a530

require('nn') just works fine, only 'cutorch' and 'cunn'.

I installed CUDA 6.5 driver and samples could be compiled correctly.

Anyone know how to solve this problem? Thanks

@soumith
Copy link
Member

soumith commented Jul 28, 2015

You've done a non-standard install (did not follow our instructions on torch.ch ), i.e. you installed torch global to the system and not local to ~/ .
While that is not usually a problem, it's really now up to you to debug. There could be so many things weird going on. First step is to see the install log and see why /usr/local/lib/lua/5.1/libcutorch.so does not exist.

@soumith soumith closed this as completed Jul 28, 2015
@tuming1990
Copy link
Author

I checked. Both libcutorch.so and libcunn.so is in folder usr/local/lib/lua/5.1. I will reinstall torch again. Thanks.

@soumith
Copy link
Member

soumith commented Jul 28, 2015

if you are reinstalling torch, please use https://github.com/torch/ezinstall/blob/master/clean-old.sh to clean up your old installation.

@tuming1990
Copy link
Author

Still the sam problem...

/Users/mingtu/torch/install/share/lua/5.1/trepl/init.lua:363: /Users/mingtu/torch/install/share/lua/5.1/cutorch/init.lua:2: cannot load '/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so'
stack traceback:
[C]: in function 'error'
/Users/mingtu/torch/install/share/lua/5.1/trepl/init.lua:363: in function 'require'
[string "_RESULT={require('cutorch')}"]:1: in main chunk
[C]: in function 'xpcall'
/Users/mingtu/torch/install/share/lua/5.1/trepl/init.lua:630: in function 'repl'
...ngtu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:185: in main chunk
[C]: at 0x01000431c0

I can still find libcutorch in folder /Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so

@soumith
Copy link
Member

soumith commented Jul 28, 2015

what's the output for the command:

luajit -l libcutorch

@soumith
Copy link
Member

soumith commented Jul 28, 2015

also for the command:

luajit -l torch -l libcutorch

@tuming1990
Copy link
Author

luajit -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #20 length (0) too small in /Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x010fe58dd0
[C]: at 0x010fe583f0
[C]: at 0x010fe2a1c0

luajit -l torch -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #20 length (0) too small in /Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x01062dadd0
[C]: at 0x01062da3f0
[C]: at 0x01062ac1c0

@tuming1990
Copy link
Author

I'm trying this:
#126

@soumith
Copy link
Member

soumith commented Jul 28, 2015

great, that might fix it.

@tuming1990
Copy link
Author

Still doesn't work. After updating cmake, do I need to reinstall torch?

@soumith
Copy link
Member

soumith commented Jul 28, 2015

after updating cmake, you'll have to reinstall cutorch / cunn:

luarocks install cutorch
luarocks install cunn

@tuming1990
Copy link
Author

Yes. I did that. But same error occurs...

@soumith
Copy link
Member

soumith commented Jul 28, 2015

what CUDA version are you running? can you upgrade to CUDA 7.0 (or even 7.5), that fixes these OSX compile issues to a large extent. CUDA on OSX used to be pretty buggy on the compiler chain till 6.5

@tuming1990
Copy link
Author

luajit -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in /Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x010fe58dd0
[C]: at 0x010fe583f0
[C]: at 0x010fe2a1c0

luajit -l torch -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in /Users/mingtu/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x01062dadd0
[C]: at 0x01062da3f0
[C]: at 0x01062ac1c0

Almost the same but "load command #20" changes to "#19"

@tuming1990
Copy link
Author

I use cuda 6.5. I will try to upgrade to 7.0.

@tuming1990
Copy link
Author

Thanks. It works now 👍

@ghost
Copy link

ghost commented Aug 26, 2015

Hi I have updated to CUDA 7.5 and I am getting same error when do
require 'cunn'

I am using ubuntu 14.04

luajit -l torch -l libcutorch
luajit: error loading module 'libcutorch' from file '/usr/local/torch/install/lib/lua/5.1/libcutorch.so':
libcudart.so.7.0: cannot open shared object file: No such file or directory
stack traceback:
[C]: at 0x0047a410
[C]: at 0x0046ab90
[C]: at 0x00406670

@ghost
Copy link

ghost commented Sep 6, 2015

I've got the same problem as @jbansal .

@ghost
Copy link

ghost commented Sep 6, 2015

Hi nmeln,
Please check your LD_LIBRARY_PATH setting. I had this problem as it was pointing to old lua folder and it is installed in new folder. So, once I set this LD_LIBRARY_PATH, it solved my problem.

Regards,
Jitendra Bansal

@ghost
Copy link

ghost commented Sep 6, 2015

@jbansal Thank you for the answer.
I think the reason why there was a problem is that I installed CUDA 7.5 after installing torch.
And it turned out that cmake in my system was outdated (2.x) so I updated it.
Then I cleaned-up (using the official script) and reinstalled torch.
Everything works now!

@zdb26
Copy link

zdb26 commented Sep 23, 2015

@nmeln Unfortunately, I install torch after CUDA 7.5, with the cmake version 3.3.2, but I'v also met the exactly same problem.......

@zdb26
Copy link

zdb26 commented Sep 23, 2015

And: My env is: OSX10.10.5, Xcode6.1.1, CUDA7.5, cmake 3.3.2

localhost:torch zhoudongbin$ luajit -l torch -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/zhoudongbin/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/zhoudongbin/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/zhoudongbin/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in /Users/zhoudongbin/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x010e2c06d0
[C]: at 0x010e2bfcf0
[C]: at 0x010e291770

@roeeaharoni
Copy link

Running OSX 10.11.2, CUDA7.5, cmake 3.4.3 and getting:

luajit -l torch -l libcutorch
luajit: error loading module 'libcutorch' from file '/Users/roeeaharoni/torch/install/lib/lua/5.1/libcutorch.so':
dlopen(/Users/roeeaharoni/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find:
/Users/roeeaharoni/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in /Users/roeeaharoni/torch/install/lib/lua/5.1/libcutorch.so
stack traceback:
[C]: at 0x010b437260
[C]: at 0x010b436880
[C]: at 0x010b4081d0

@mattyd2
Copy link

mattyd2 commented Mar 25, 2016

@roeeaharoni have you been able to resolve this issue? I'm running into the same issue.

Environment:

  • OSX10.11
  • Xcode 6.2 to be compatible with CUDA 7.5.20
  • CUDA 7.5.20
  • cmake 3.5.0

When I run luajit -l torch -l libcutorch - I've removed my username for brevity.

luajit: error loading module 'libcutorch' from file '~/torch/install/lib/lua/5.1/libcutorch.so': dlopen(~/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find: ~/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in ~/torch/install/lib/lua/5.1/libcutorch.so stack traceback: [C]: at 0x0104946260 [C]: at 0x0104945880 [C]: at 0x01049171d0

When I run $ luajit -l libcutorch:

luajit: error loading module 'libcutorch' from file '/Users/matthewdunn/torch/install/lib/lua/5.1/libcutorch.so': dlopen(/Users/matthewdunn/torch/install/lib/lua/5.1/libcutorch.so, 6): no suitable image found. Did find: /Users/matthewdunn/torch/install/lib/lua/5.1/libcutorch.so: malformed mach-o image: load command #19 length (0) too small in /Users/matthewdunn/torch/install/lib/lua/5.1/libcutorch.so stack traceback: [C]: at 0x0109aae260 [C]: at 0x0109aad880 [C]: at 0x0109a7f1d0

I pretty sure I've done a completely standard install as I did it on a clean install of OSX 10.11

Any help will be greatly appreciated.

@Shaahinan
Copy link

Hi Guys, I am trying to run a .lua code with Torch7, I came across these errors, I would be really appreciative if someone can help me:
/home/angizi/torch/install/bin/luajit: /home/angizi/torch/install/share/lua/5.1/trepl/init.lua:389: module 'cutorch' not found:No LuaRocks module found for cutorch
no field package.preload['cutorch']
no file '/home/angizi/.luarocks/share/lua/5.1/cutorch.lua'
no file '/home/angizi/.luarocks/share/lua/5.1/cutorch/init.lua'
no file '/home/angizi/torch/install/share/lua/5.1/cutorch.lua'
no file '/home/angizi/torch/install/share/lua/5.1/cutorch/init.lua'
no file '/home/angizi/.luarocks/share/lua/5.2/cutorch.lua'
no file '/home/angizi/.luarocks/share/lua/5.2/cutorch/init.lua'
no file '/home/angizi/torch/install/share/lua/5.2/cutorch.lua'
no file '/home/angizi/torch/install/share/lua/5.2/cutorch/init.lua'
no file './cutorch.lua'
no file '/home/angizi/torch/install/share/luajit-2.1.0-beta1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch.lua'
no file '/usr/local/share/lua/5.1/cutorch/init.lua'
no file '/home/angizi/.luarocks/lib/lua/5.1/cutorch.so'
no file '/home/angizi/torch/install/lib/lua/5.1/cutorch.so'
no file '/home/angizi/torch/install/lib/cutorch.so'
no file '/home/angizi/.luarocks/lib/lua/5.2/cutorch.so'
no file '/home/angizi/torch/install/lib/lua/5.2/cutorch.so'
no file './cutorch.so'
no file '/usr/local/lib/lua/5.1/cutorch.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'error'
/home/angizi/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
main.lua:11: in main chunk
[C]: in function 'dofile'
...gizi/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00406670

Please help me

@chaopengshen
Copy link

I'm getting the same error. The machine in question has an existing global torch installation. I have no root authority so I have to install luarocks packages locally. I find the code to be calling the cutorch.so in the global torch directory, instead of the local directory I installed it too. I suspect other packages I installed has conflicts with global cutorch. I could have installed the entire torch myself but this system has RHEL 6.0 which does not support "bash install-deps". These get me stuck!

@albanD
Copy link
Contributor

albanD commented Dec 4, 2017

@chaopengshen the install-deps script just install dependencies for torch, if torch is already installed somewhere else, these dependencies are already installed, you can skip this step and just run the ./install.sh script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants