extism / python-pdk

Write Extism plugins in Python
https://extism.org
11 stars 1 forks source link

Sometimes running `extism-py` prints `Could not find platform dependent libraries <exec_prefix>` #16

Open zshipko opened 1 week ago

zshipko commented 1 week ago

We should look into what's causing that message and how to fix it

mapix commented 1 week ago

@zshipko I encountered the same issue on my Mac M1. My Python environment was created with Conda using Python 3.11 (since 3.12 seems to break some syntax). This error prevents operations involving JSON from working. Interestingly, compiling in the root directory of the python-pdk repository works fine, but not in other directories. I was able to bypass the issue by setting PYTHONPATH and PYTHONHOME.

(exism) [Proxy] ➜  python-pdk git:(main) ✗ ./extism-py examples/count-vowels.py -o count-vowels.wasm 
(exism) [Proxy] ➜  python-pdk git:(main) ✗ extism call out.wasm count_vowels --wasi --input='Hello World Test!'
Error: open out.wasm: no such file or directory
(exism) [Proxy] ➜  python-pdk git:(main) ✗ extism call count-vowels.wasm count_vowels --wasi --input='Hello World Test!' 
{"count": 4}
(exism) [Proxy] ➜  python-pdk git:(main) ✗ extism-py examples/count-vowels.py -o count-vowels.wasm                    
(exism) [Proxy] ➜  python-pdk git:(main) ✗ cd ..
(exism) [Proxy] ➜  workspace  ✗ extism-py python-pdk/examples/count-vowels.py -o python-pdk/count-vowels.wasm
Could not find platform dependent libraries <exec_prefix>
(exism) [Proxy] ➜  workspace  ✗ PYTHONPATH=$(python -c "import sys, os.path; print(':'.join([p for p in sys.path if os.path.exists(p)]))") PYTHONHOME=$(python -c "import sys;print(sys.exec_prefix)") extism-py python-pdk/examples/count-vowels.py -o python-pdk/count-vowels.wasm
(exism) [Proxy] ➜  workspace ✗ extism call python-pdk/count-vowels.wasm count_vowels --wasi --input='Hello World Test!' 

{"count": 4}
zshipko commented 2 hours ago

Re-opening, it looks like this is not fixed by #17