Lunatic-python help

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
meteopath
Prole
Posts: 19
Joined: Sun May 15, 2022 12:41 am

Lunatic-python help

Post by meteopath »

Hi, beginner programmer here. Can someone help with lunatic-python? I couldn't get it to work via clone or PIP, and unfortunately I can't tell whether I have an issue with lunatic-python or whether it's something local. I have reason to suspect both and don't know enough to figure out which it is. One problem is that Lunatic-Python (by bastibe) doesn't have explicit install instructions. It says
To install, you will need to have the Python and Lua development libraries on your system. If you do, use the recommended methods (pip, easy-install, etc) to install lunatic-python.
But I can't find bastibe on pip. The only lunatic-python I found on pip is by OddSource, which is a less-starred fork of bastibe's work. So I'm suspicious of it. But then when I try to install it (pip install lunatic-python-universal), and it fails, I get the error message:

Code: Select all

  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      pkg-config failed for `python` (tried `python-3.8` and `python3.8`); most recent output was:
      /bin/sh: pkg-config: command not found
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
which makes me think that maybe python is unfindable on my computer. Is that what that means: 'pkg-config failed...command not found'? I've had problems with my PATH before and unfortunately still don't understand it well enough to troubleshoot.

As for the clone, I get a 'module not found' when I try to run the lua file. I messed around with a few different things in the 'require' path and always got module not found. I even got the same error message when running the lua test file included in the clone.

Thanks for reading.
ii41
Prole
Posts: 1
Joined: Thu Jun 02, 2022 9:29 pm

Re: Lunatic-python help

Post by ii41 »

To me, the error message seems to be complaining that you don't have the packge whose name is "pkg-config" on your machine. "pkg-config" is a build tool for C projects, and lunatic-python is a C project.

I didn't find any lua files except for one test file in bastibe's repo, so I'm not sure how you got to see "module not found" when running some lua file.

I did get the library working. What I did was cloning bastibe's repo, installing cmake, make, gcc, g++, pkg-config, lua5.1, python3.9, changing CMakeLists.txt so that intead of python2.7 libs it looks for python 3.9 libs, and then in the repo's root directory

Code: Select all

cmake CMakeLists.txt
make
This creates a lua.so and a python.so. In the directory where they reside you can then `import lua` or `require "python"`.
Last edited by ii41 on Thu Jun 02, 2022 10:25 pm, edited 2 times in total.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests