lupa icon indicating copy to clipboard operation
lupa copied to clipboard

Use luajit from a different location?

Open matthiasplappert opened this issue 10 years ago • 4 comments

Hi there, I'm trying to use lupa with lua installed in a non-standard location. Is it somehow possible to point lupa to that location instead of using the default location? Concretely, when I attempt to load a file that uses torch, I get the following error:

Type "help", "copyright", "credits" or "license" for more information.
>>> from lupa import LuaRuntime
>>> lua = LuaRuntime(unpack_returned_tuples=True)
>>> lua.require('train_agent')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lupa/_lupa.pyx", line 268, in lupa._lupa.LuaRuntime.require (lupa/_lupa.c:4683)
  File "lupa/_lupa.pyx", line 1245, in lupa._lupa.call_lua (lupa/_lupa.c:17287)
  File "lupa/_lupa.pyx", line 1254, in lupa._lupa.execute_lua_call (lupa/_lupa.c:17400)
  File "lupa/_lupa.pyx", line 1207, in lupa._lupa.raise_lua_error (lupa/_lupa.c:16746)
lupa._lupa.LuaError: ./initenv.lua:8: module 'torch' not found:
    no field package.preload['torch']
    no file '/usr/local/share/lua/5.2/torch.lua'
    no file '/usr/local/share/lua/5.2/torch/init.lua'
    no file '/usr/local/lib/lua/5.2/torch.lua'
    no file '/usr/local/lib/lua/5.2/torch/init.lua'
    no file './torch.lua'
    no file '/usr/local/lib/lua/5.2/torch.so'
    no file '/usr/local/lib/lua/5.2/loadall.so'
    no file './torch.so'
>>>

Everything works fine if I load the file using luajit from the torch installation using ~/torch/install/bin/luajit train_agent.lua.

Is it possible to somehow make this work? Any help is greatly appreciated!

matthiasplappert avatar Jun 12 '15 09:06 matthiasplappert

I have a "hackish" fork where you can use Lupa with Torch (I guess you also wanted to play with DQN)

If there is some interest, I can spend a little more time, clean it up and submit a proper PR.

jleni avatar Sep 06 '15 18:09 jleni

Do you still have that fork @jleni?

mdtux89 avatar Jan 14 '16 12:01 mdtux89

Sure, though I have not used it lately. Drop me a message if it doesn't work and I will have a look

jleni avatar Jan 22 '16 10:01 jleni

It works just fine, @jleni. Thanks!

mdtux89 avatar Jan 22 '16 12:01 mdtux89