-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building for Python 3 #11
Comments
Hi Lassi, my impression is that the Python 3.6 headers are not used, but rather the 2.7 ones, which of course works until the linking stage. Then, linking with Pd used lazy linking (-undefined dynamic_lookup option), shadowing missing linker symbols. I am pretty sure the change to the Python 3 API is not as effortless as one might wish. |
I have made a python3 branch which makes tiny changes to the build system. It should still work with 2.7 but now use the proper paths to the Python headers. |
I went through the errors and fixed the ones I could. I have a commit in my fork that tries to fix the easiest changes, but had to comment out or inadequately fix some. f807ad6 It builds, but this version crashes PD when loaded (no surprises there). I was wondering if there's any way to get information on what is going wrong or some way to test that the code behaves like it did before the changes. |
Thanks, i have had a quick look but fail to understand a few replacements of old versus new functions. In any case, all adaptations of the code should be conditional so that compilation works for both python2 and python3 APIs. |
I responded to the comments in the commit. And made a new commit with Unicode checks: 3908b2b Yeah, compatibility with Python 2 and 3 would be ideal, but unfortunately that is probably beyond the scope of my abilities. I currently just need something that works with Python3, which would be a good milestone to getting something that works for both. Though it seems I've hit a dead end. Without a really good understanding of the system (or comprehensive way to test it), replacing functions in the code will mostly lead to nonsensical changes. Gaining the understanding solely through reading code with my level in C++ would take a very long time. Currently I only see that PD crashes when I try to load py with the changes. As it stands, my fork points out parts of the code that need some sort of update for Python3 compatibility. Don't really know how to move forward from here. |
The replacement for this part in pybase.cpp is the thing that is crashing. And it is related to the new module initialization system, but I don't know how to make it work correctly on the new system. |
Hi all, I am trying to build the source using flext. I couldn't get rid of the following error: source/pyprefix.h:20:10: fatal error: 'Python/Python.h' file not found any ideas? |
Python2 is reaching EOL in about 100 days from now. Debian is currently fading out all packages that still require Python2 (including py). Maybe it's time :-) |
Yes, absolutely. I have been working on a branch for python3 development. https://github.com/grrrr/py/tree/python3 |
i became aware of the |
hello, i forked @grrrr's python3 branch and am working on it here https://github.com/SopiMlab/py/tree/python3 (also includes some build tweaks for Conda support on Mac) i can build the code for Python 3.7 and 2.7, but i have some runtime issues... on 3.7, the external initializes successfully. when i open on 2.7, i get a crash on init like this:
i guess the next step is to get a debugging environment set up :) i found the instructions on the Pd site, but if anyone has experience doing this with pyext specifically, any tips are appreciated! |
for me, it has been crashing with python2.7 for a while.
given that python2 is dead now, i wouldn't invest time in fixing it
|
i figured out how to debug with lldb and i'm making progress :) our fork now runs at least the examples notably, the buffer examples are currently broken. i will work on that next monday. in the interest of staying compatible with existing code, i am still making sure pyext builds against Python 2, but not currently testing on it. i imagine the crashes will not be hard to fix. |
Hi @ahihi , just wanted to give a thumbs up... it's a great effort, will check it out shortly! |
i am happy to report that our fork is mostly working on both python 3 and 2! 🎉 i have tested with:
remaining issues that i know of:
one major issue i ran into was that the |
yay! really looking forward to be able to use Python3.7 with Max! |
ahahi, unfortunately the python3 branch in your fork would not compile on my setup - here is the error: "source/pyext.cpp:709:1: error: designator order for field ‘_typeobject::tp_basicsize’ does not match declaration order in ‘PyTypeObject’ {aka ‘_typeobject’} " Your branch was my last hope at getting some Python3-only code running in pd. At this stage it looks like pyext is unusable as python 2 is no longer widely supported. |
@jeremiahrose which OS and Python version are you running? and how is your Python installed (e.g. installer from python.org, conda, etc)? |
@ahihi Python 3.7.3 installed via apt on Rasbian 10 (Buster). |
@jeremiahrose our main target so far is macOS and unfortunately we don't currently have the resources to work on other plarforms :/ i may give it a try on a Pi when i have some spare time, but can't promise anything... |
btw, @ahihi did you ever get to compile it successfully as an external for max? |
@omarcostahamido afraid not, i don't have Max. |
@ahihi I am just trying to build your fork but getting the following error message:
gives
The same error occurs, if I include Any ideas? |
@fhchl i haven't had the chance to test on linux at all, but from a quick glance at the code, |
@ahihi could you please allow issues in your fork? i think we should discuss all problems with the port in the fork (probably in multiple issues), rather than abusing this ticket... |
@umlaeute thanks for the suggestion, i didn't know that was an option! 😅 i don't have admin access but i will ask my supervisor to do it. |
just wanted to note that
|
Hi,
I've been trying to get PD working with Python 3 and even though I got this external to build with Python 3.6, PD says "can't load library". (A 2.7. build worked fine).
I heard that it is likely due to differences in the C API between Python 2.7 and Python 3, but I'm not too familiar with this area and lost on the topic.
Anyone have experience at this or any good resources? I found this, but don't really know where to go to from here.
The text was updated successfully, but these errors were encountered: