camel icon indicating copy to clipboard operation
camel copied to clipboard

[Feature Request] Integrate Prolog into Camel Tools

Open hu-xianglong opened this issue 9 months ago • 0 comments

Required prerequisites

  • [x] I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
  • [x] Consider asking first in a Discussion.

Motivation

Prolog is integrated with Python via Pyswip, however, it requires run-time dependencies of Prolog engine.

The current implementation uses Pyswip to integrate Prolog with Python. However, this creates a runtime dependency on the SWI-Prolog engine, which must be installed on the host system. Users encounter errors like:

ImportError: libswipl.so.8: cannot open shared object file: No such file or directory

or on macOS:

ImportError: dlopen(/usr/local/lib/python3.11/site-packages/pyswip/core/_pyswip.cpython-311-darwin.so, 0x0002): 
  tried: '/usr/local/lib/libswipl.dylib' (no such file), '/usr/lib/libswipl.dylib' (no such file)

This is a common issue with Python packages that rely on external system libraries (e.g., OpenCV, PyAudio). Simply installing via pip/poetry is insufficient as the system-level dependencies must be manually installed.

Proposed Solution: Docker-based Code Execution

Architecture Overview

  1. Create a Docker container with all required dependencies
  2. Implement a code execution service that:
    • Accepts Prolog code and input
    • Runs the code in an isolated container
    • Returns the results
  3. Add a fallback mechanism for local execution

Solution

No response

Alternatives

No response

Additional context

No response

hu-xianglong avatar Mar 01 '25 16:03 hu-xianglong