[SOLVED]Error loading pyo external object in Pd #299
Replies: 3 comments 2 replies
-
|
I've finally managed to build the [pyo~] object and load it in Pd with the help of IOhannes zmoelnig from Pd's mailing list. Here's the mail that provided the solution https://www.mail-archive.com/pd-list@lists.iem.at/msg26544.html |
Beta Was this translation helpful? Give feedback.
-
|
Here's the procedure to compile the [pyo~] object: First of all, you'll need Pd's current external objects builder, which you can get here https://github.com/pure-data/pd-lib-builder. I guess lines 70-73 in m_pyo.h should change to the following (a comment above these mentions that the Python version in embedded Pyo is hardcoded to 3.9, and that it's not a good idea): Then make the object with the following: The last two bits (m_pyo.h and the make commad) should use the Python version you have installed or built Pyo against. If when loading the object in Pd you get the following error: run |
Beta Was this translation helpful? Give feedback.
-
|
thank you Alexandros ! I will give it a try.
Best
Yan
… On 15 Jul 2025, at 09:02, Alexandros Drymonitis ***@***.***> wrote:
Here's the procedure to compile the [pyo~] object:
First of all, you'll need Pd's current external objects builder, which you can be here https://github.com/pure-data/pd-lib-builder.
You need to create a directory with your Pd externals, usually that's /home/Documents/Pd/externals. Move the pd-lib-builder directory in there, and the [pyo~] external sources there too (in its own directory).
Copy the m_pyo.h file into the pyo~ external directory, and change the Makefile to the following:
# Makefile for pyo~
lib.name = pyo~
class.sources = pyo~.c
PKG_CONFIG := pkg-config
PYTHON=python3
PY_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PYTHON))
PY_LIBS := $(shell $(PKG_CONFIG) --libs $(PYTHON))
cflags += $(PY_CFLAGS) -I../
ldlibs += $(PY_LIBS)
datafiles = pyo-help.pd README.md
PDLIBBUILDER_DIR=../pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
I guess lines 70-73 in m_pyo.h should change to the following (a comment above these mentions that the Python version in embedded Pyo is hardcoded to 3.9, and that it's not a good idea):
#ifdef __linux__
libpython_handle = dlopen("libpython3.13.so", RTLD_LAZY | RTLD_GLOBAL);
#elif __APPLE__
libpython_handle = dlopen("libpython3.13.dylib", RTLD_LAZY | RTLD_GLOBAL);
Then make the object with the following:
make PY_LIBS="-lpython3.13"
The last two bits (m_pyo.h and the make commad) should use the Python version you have installed or built Pyo against.
—
Reply to this email directly, view it on GitHub <#299 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZ2APDNQBYZNWAGURRNHN33ISRO7AVCNFSM6AAAAAB27W5EVGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNZWGEYTQNI>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building the Pd object from the embed directory in Pyo (BTW, I managed to build it with the new Makefile that is used throughout the Pd community, I'll make a pull request for that), but when I try to load it in Pd, I get the following error (this error has been there for quite some time, but now I managed to resolve some other issues, hence I'm reviving this):
I'm linking the Pd object to Python3.11 for the same reasons defined here #297
By looking into Python's source files, this _Py_NoneStruct
is an object of undefined type which can be used in contexts. This is found in line 641 in object.h in Python's source files.In line 646 of the same file, it reads
PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */In line 647 it reads
#define Py_None (&_Py_NoneStruct)In Pyo's m_pyo.h file which is common for all embedded projects (Pd, OF, Juce), the only reference to Py_None is in line 482. Here's the code:
I tried to comment these lines out, but the I get the following error when loading the object in Pd:
So, is there something wrong with linking Python here? Here's my Makefile, which uses pd-lib-builder:
And here's line 71 of m_pyo.h
Beta Was this translation helpful? Give feedback.
All reactions