WindowsTorch
WindowsTorch copied to clipboard
Torch not found
downloaded 64 bits version, ran paths, then ran
luajit, I get some console that says th> but when I try to run torch.Tensor{1,2,3} it says attempt to call global torch. Any ideas :/.
earlier with a totally different branch of torch for windows it couldnt load torch.dll into lua.
You need to require('torch')
first:
LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
_____ _
|_ _| | |
| | ___ _ __ ___| |__
| |/ _ \| '__/ __| '_ \
| | (_) | | | (__| | | |
\_/\___/|_| \___|_| |_|
JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
th> require('torch')
th> torch.test()
Running 154 tests
1/154 tanh ............................................................ [PASS]
2/154 testCholesky .................................................... [PASS]
3/154 multinomialvector ............................................... [PASS]
...
Hope this helps!
The first things to check with dll load errors are:
- Is the dll in a directory listed in your PATH or in the same directory as the calling exe?
- Are the caller and the dll of the same bitness (eg, both are 64-bit)?
Could somebody help me? What did I do wrong:
- I downloaded the WindowsTorch-64-bit_LuaJIT-2-1b2.zip.
- unpacked whole content to the c:\torch
- ran the setpaths.cmd
- ran the c:\torch\bin\luajit.exe
- wrote this: require('torch')
LuaJIT 2.1.0-beta2 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
_____ _
|_ _| | |
| | ___ _ __ ___| |__
| |/ _ \| '__/ __| '_ \
| | (_) | | | (__| | | |
\_/\___/|_| \___|_| |_|
JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
th> require('torch')
stdin:1: module 'torch' not found:
no field package.preload['torch']
no file '.\torch.lua'
no file 'C:\Torch\bin\lua\torch.lua'
no file 'C:\Torch\bin\lua\torch\init.lua'
no file '.\torch.dll'
no file 'C:\Torch\bin\torch.dll'
no file 'C:\Torch\bin\loadall.dll'
stack traceback:
[C]: in function 'require'
stdin:1: in main chunk
[C]: at 0x7ff66c2e2020
th> help()
stdin:1: attempt to call global 'help' (a nil value)
stack traceback:
stdin:1: in main chunk
[C]: at 0x7ff66c2e2020
Solution found :-) setpaths.cmd did not set the system variables, so I did it manually
Hello, I downloaded Windows Torch 64-bit version, and manually added paths like shows following image (as setpaths didn't seem to work):
After doing cd C:\torch\bin\luajit, require('torch') and torch.test(), it seems to work, as the word PASS is printed, though the encoding doesn't shows correctly:
But when I try to run it on Visual Studio Code, it doesn't work
Any ideas about it?
@ayrtondenner @vaclavmuller: setpaths.cmd sets the paths only for the command prompt from which it is called, so yes, you have to either issue these commands successively in a single command prompt:
-
C:\torch\setpaths.cmd
-
luajit
or you can add the paths permanently to the system paths by yourself.
@ayrtondenner: Are you trying to use Torch in Python? This version is for Lua. You might want to take a look at PyTorch.
Didn't know the difference between both versions, sorry. Just installed PyTorch via conda install, now it's working properly, thanks.
No problem, glad to hear that you got PyTorch working!
@hiili : Can we set paths such that "th" command is available across different terminal windows ? As "luajit" is able to open the "th" prompt but my python files are still not able to find the "th" command.
@Saahiljeet-Singh: Would it solve your problem if you add the paths manually to your system-wide environment variables?
@hiili hi,same problem here. the 'th' command can't be found and it seems that adding the paths manually to system-wide environment variables doesn't work.
Here is the added system-wide environment variables.
Hi! I'm not working on this actively anymore and don't have it on my computer at the moment, so I can't test things on my end unfortunately.
Have you made sure that you have all the vars set that are modified in setpaths.cmd? Also, have you restarted the process (command prompt?) in which you try to use Torch after adding the paths?
I did set all the vars in the setpaths.cmd. And I have tried to restart the process however, the 'th' command can't be found neither before nor after I restart the process. But I can use the 'luajit' command without run the setpaths.cmd now. Does it has the same function with the 'th' command?
Solution found :-) setpaths.cmd did not set the system variables, so I did it manually
hello,
Weird issue here. if I run the cmd file, then require('torch') returns no error. if i don't, then it return error just like yours. Fun thing here, I have set the system variable manually. and I am fairly sure that I correctly set the variables, any idea?
Thanks,
@ayrtondenner @vaclavmuller: setpaths.cmd sets the paths only for the command prompt from which it is called, so yes, you have to either issue these commands successively in a single command prompt:
C:\torch\setpaths.cmd
luajit
or you can add the paths permanently to the system paths by yourself.
@ayrtondenner: Are you trying to use Torch in Python? This version is for Lua. You might want to take a look at PyTorch.
Hi,
I am using this torch with lua. and my lua file is in D drive as the torch is installed in the C:/torch. I want to permanently add those variables from the cmd command file but it did not seem to work. I can show you more proof but any idea why at this point?
does the lua file needs to be in the same directory as the torch?
Thanks,