lunatic-python / lupa import issue on ubuntu

863 Views Asked by At

I tried installing Lua and the wrapper libraries for the same on my computer, but the execution fails in the following manner.

After installing Lua-5.1, torch7, lua ( lunatic-python) , lupa, python-lua

when i open the interpreter -

    >>  import lupa
    >>  Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/lupa-1.1-py2.7-             
      linux-x86_64.egg/lupa/__init__.py", line 31, in <module>
      from lupa._lupa import *
      ImportError: /usr/local/lib/python2.7/dist-packages/lupa-1.1-      py2.7-linux-x86_64.egg/lupa/_lupa.so: undefined symbol: lua_gettop

and for lua

    >>  import lua
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: /usr/local/lib/python2.7/dist-packages/lua.so: undefined symbol: lua_gettop

The installation returned no errors, however I had installed Lua5.3 ( which i uninstalled earlier ) added sys path to the /usr/local/bin and lib folders but to no avail.

Can someone help me with this? I'm new to these libraries and languages. Config - 64bit, Ubuntu 14.04. Using python2.7 for this

1

There are 1 best solutions below

0
On BEST ANSWER

I was doing something similar. I could import lupa by preloading libluajit:

import ctypes
lualib = ctypes.CDLL("libluajit.so", mode=ctypes.RTLD_GLOBAL)
import lupa

I've got some ideas from the following discussion:

interfacing Python and Torch7(Lua) via shared library

By the way, there is a branch of Lupa that supports Torch:

Lupa for torch