ansible/ansible-rulebook

Installation requirements missing

ezequiels opened this issue · 2 comments

  • ansible-rulebook version: '0.9.4'
  • Python version: 3.10
  • Operating System: MacOS 12.6

Java Open JDK:

openjdk 19 2022-09-20
OpenJDK Runtime Environment Homebrew (build 19)
OpenJDK 64-Bit Server VM Homebrew (build 19, mixed mode, sharing)

Description

  1. Missing "Installation requirements section" and missing instructions for MacOS.
  2. This derives on an issue installing and running on MacOS on M1 where:

jpyutil - WARNING: Failed to preload JVM shared library. No shared library found.
WARNING:jpyutil:Failed to preload JVM shared library. No shared library found.
ERROR:ansible_rulebook.cli:Unexpected exception
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/ansible_rulebook/cli.py", line 145, in main
asyncio.run(app.run(args))
File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/opt/homebrew/lib/python3.10/site-packages/ansible_rulebook/app.py", line 66, in run
await run_rulesets(
File "/opt/homebrew/lib/python3.10/site-packages/ansible_rulebook/engine.py", line 289, in run_rulesets
rulesets_queue_plans = rule_generator.generate_rulesets(
File "/opt/homebrew/lib/python3.10/site-packages/ansible_rulebook/rule_generator.py", line 247, in generate_rulesets
drools_ruleset = DroolsRuleset(
File "", line 6, in init
File "/opt/homebrew/lib/python3.10/site-packages/drools/ruleset.py", line 31, in _make_jpy_instance
jpyutil.init_jvm(jvm_maxmem=max_mem, jvm_classpath=[jar_file_path])
File "/opt/homebrew/lib/python3.10/site-packages/jpyutil.py", line 453, in init_jvm
import jpy
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/jpy.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_JNI_CreateJavaVM)

What I Did

pip install wheel ansible-rulebook ansible ansible-runner                          ✔  08:30:07 AM  
Requirement already satisfied: wheel in /opt/homebrew/lib/python3.10/site-packages (0.37.1)
Requirement already satisfied: ansible-rulebook in /opt/homebrew/lib/python3.10/site-packages (0.9.4)
Requirement already satisfied: ansible in /opt/homebrew/lib/python3.10/site-packages (6.5.0)
Requirement already satisfied: ansible-runner in /opt/homebrew/lib/python3.10/site-packages (2.2.1)
Requirement already satisfied: drools-jpy in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (0.0.8)
Requirement already satisfied: jinja2 in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (3.1.2)
Requirement already satisfied: janus in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (1.0.0)
Requirement already satisfied: pyparsing>=3.0 in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (3.0.9)
Requirement already satisfied: redis in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (4.3.4)
Requirement already satisfied: dpath in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (2.0.6)
Requirement already satisfied: websockets in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (10.3)
Requirement already satisfied: jsonschema in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (4.16.0)
Requirement already satisfied: durable-rules in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (2.0.28)
Requirement already satisfied: asyncio in /opt/homebrew/lib/python3.10/site-packages (from ansible-rulebook) (3.4.3)
Requirement already satisfied: ansible-core~=2.13.5 in /opt/homebrew/lib/python3.10/site-packages (from ansible) (2.13.5)
Requirement already satisfied: python-daemon in /opt/homebrew/lib/python3.10/site-packages (from ansible-runner) (2.3.1)
Requirement already satisfied: pexpect>=4.5 in /opt/homebrew/lib/python3.10/site-packages (from ansible-runner) (4.8.0)
Requirement already satisfied: pyyaml in /opt/homebrew/lib/python3.10/site-packages (from ansible-runner) (6.0)
Requirement already satisfied: packaging in /opt/homebrew/lib/python3.10/site-packages (from ansible-runner) (21.3)
Requirement already satisfied: six in /opt/homebrew/lib/python3.10/site-packages (from ansible-runner) (1.16.0)
Requirement already satisfied: cryptography in /opt/homebrew/lib/python3.10/site-packages (from ansible-core~=2.13.5->ansible) (38.0.1)
Requirement already satisfied: resolvelib<0.9.0,>=0.5.3 in /opt/homebrew/lib/python3.10/site-packages (from ansible-core~=2.13.5->ansible) (0.8.1)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/homebrew/lib/python3.10/site-packages (from jinja2->ansible-rulebook) (2.1.1)
Requirement already satisfied: ptyprocess>=0.5 in /opt/homebrew/lib/python3.10/site-packages (from pexpect>=4.5->ansible-runner) (0.7.0)
Requirement already satisfied: jpy in /opt/homebrew/lib/python3.10/site-packages (from drools-jpy->ansible-rulebook) (0.12.0)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /opt/homebrew/lib/python3.10/site-packages (from janus->ansible-rulebook) (4.4.0)
Requirement already satisfied: attrs>=17.4.0 in /opt/homebrew/lib/python3.10/site-packages (from jsonschema->ansible-rulebook) (22.1.0)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/homebrew/lib/python3.10/site-packages (from jsonschema->ansible-rulebook) (0.18.1)
Requirement already satisfied: lockfile>=0.10 in /opt/homebrew/lib/python3.10/site-packages (from python-daemon->ansible-runner) (0.12.2)
Requirement already satisfied: setuptools in /opt/homebrew/lib/python3.10/site-packages (from python-daemon->ansible-runner) (65.4.1)
Requirement already satisfied: docutils in /opt/homebrew/lib/python3.10/site-packages (from python-daemon->ansible-runner) (0.19)
Requirement already satisfied: deprecated>=1.2.3 in /opt/homebrew/lib/python3.10/site-packages (from redis->ansible-rulebook) (1.2.13)
Requirement already satisfied: async-timeout>=4.0.2 in /opt/homebrew/lib/python3.10/site-packages (from redis->ansible-rulebook) (4.0.2)
Requirement already satisfied: wrapt<2,>=1.10 in /opt/homebrew/lib/python3.10/site-packages (from deprecated>=1.2.3->redis->ansible-rulebook) (1.14.1)
Requirement already satisfied: cffi>=1.12 in /opt/homebrew/lib/python3.10/site-packages (from cryptography->ansible-core~=2.13.5->ansible) (1.15.1)
Requirement already satisfied: pycparser in /opt/homebrew/lib/python3.10/site-packages (from cffi>=1.12->cryptography->ansible-core~=2.13.5->ansible) (2.21)

Hi @ezequiels This seems a installation issue of jpy. Seems that jpy was already installed, it must be installed without the default precompiled libraries.
Uninstall jpy, ensure that JAVA_HOME and PIP_NO_BINARY are properly defined as is described here and try it again:

pip uninstall jpy
pip install -U ansible-rulebook --no-cache-dir

You should see a line like: Skipping wheel build for jpy, due to binaries being disabled for it.

Your instructions have solved the issue. Thank you.