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

any detailed installation guide on Ubuntu 16.04? #65

Open
goodnamegood opened this issue Oct 8, 2017 · 1 comment
Open

any detailed installation guide on Ubuntu 16.04? #65

goodnamegood opened this issue Oct 8, 2017 · 1 comment

Comments

@goodnamegood
Copy link

There isn't any installation guide in the README file. I've tried to use pip install lunatic-python but it didn't work. Could anyone provide the necessary guidance and hopefully update the README file?

@user202729
Copy link
Contributor

user202729 commented Oct 26, 2021

This fork seems to be the most well-maintained one, although the instruction guide isn't that clear (unfortunately).

For the build/install itself, unfortunately it's not very obvious, but it's mentioned in several past (closed) issues, such as #74 .


Commonly-made mistakes

  • lunatic-python package on pypi is the old package, not this fork.
  • lunatic-python-universal is this other fork OddSource/lunatic-python: A two-way bridge between Python and Lua.
    It can be installed from pip (as far as I can see, that would only allow calling Lua from Python, not vice versa, just like Lupa)
  • Do not run make at top level. The Makefile does not work anymore.
  • Do not run python setup.py at top level. The setup.py file does not work anymore since the PYTHON_LIBRT update.

Build

cmake -B build
cmake --build build

Specify Python version

Specify Lua version

  • -D LUA_LIBRARY=/usr/lib/liblua5.3.so -D LUA_INCLUDE_DIR=/usr/include/lua5.3/

Note that if these 2 points to different Lua versions they will still compile but may raise "undefined symbol" error.

Documentation: https://cmake.org/cmake/help/latest/module/FindLua.html (TODO where is LUA_LIBRARY documented?)

Result

After this you should get files build/bin/lua.so and build/bin/python.so, which are the libraries.

Install

Import Python from Lua

In order to allow require "python" in Lua, copy the python.so library to somewhere that Lua can access, such as /usr/lib/lua/5.4 or /usr/lib/lua/5.3
(checks package.cpath and _VERSION in Lua environment, for LuaLaTeX there are special instructions, see https://tex.stackexchange.com/a/372134/250119).

Import Lua from Python

Linking it to Python packages library with an appropriate name would work with the command

sudo ln -s -T /usr/local/lib/python3.8/dist-packages/lua.cpython-38-x86_64-linux-gnu.so /usr/local/lib/lua/5.1/python.so

Change the version accordingly.

Reference: #74 (comment).

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

2 participants