-
Notifications
You must be signed in to change notification settings - Fork 63
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
Support Python 3.11 in the Python target #1458
Comments
With Python version 3.11.3, running Composition.lf results in a segmentation fault. The stack trace is here:
Line 324 of python target.c is the
Apparently, The segfault occurs because the above call to Possibly useful resources: |
I want to add a data point on my end. I am running Python 3.10 (same one as the one used in the macOS GitHub action) on macOS and got a segmentation fault for ActionDelay.lf. So perhaps it's not the problem with Python 3.11 but something else in the runtime.
|
I am not able to reproduce this. Note that you are using the command |
Yes, I am inside a Conda environment
|
I've created a branch of both lingua-franca and reactor-c called python-11 that has a start on this. It gets passed the segfault, but fails to import the module. The reason is unclear. |
The branch |
While I don't think we need this for the release, it would be fine to bump our requirement for Python to |
To further document this issue, on my machine, it seems that cmake was finding a different Python from the one in my path. This is probably also happening to others, which could account for the segfaults that @lsk567 is seeing. The output from
This Python is not even in my PATH, so I have no idea how or why cmake would choose it. The version of
The fix for this was to change the code generator to generate a cmake file that requires Python 3.11. I'm not sure whether there is a better way to ensure that the version of Python used to generate the code is the same as the version in the user's path. |
Matching the Python version may be more flexible, but also more difficult to maintain and likely to cause issues down the road... |
Thanks for taking a closer look, @edwardalee. This is exactly the issue. On my machine, cmake finds Python 3.7, which is not the version I use in my conda environment.
Updating the requirement to Python 3.10 seems to solve the issue.
The corollary seems to be that we should raise the lower bound to be above Python 3.7 at least. Update: |
According to the cmake documentation of I am not sure why cmake chose Python 3.7 in Shaokai's post. We had a debugging session today, and we were not able to reproduce this. cmake consistently chose Python 3.10 for various settings. We made three important observations today:
I think we should try to resolve the discrepancy between the default python interpreter of the system and the one selected by cmake. Since it is difficult to influence cmakes choice in a portable way, I think we should push the user to use the right interpreter. We could simply parse cmake's output and extract the path to the interpreter that it selected. On my machine cmake prints
we could print:
We could even take this one step further and generate a bash (or batch on windows) script in A more reliable way than parsing the output to get the Python interpreter path could be to let cmake write the path to a file using UPDATE: Actually we could let cmake generate the launchscipt and completely avoid the feedback from cmake to lfc. |
Generating a launch script in bin seems like just the right thing to do. This would make launching programs consistent and it encodes in a more permanent way the output from lfc. |
Looks like this was fixed in #1902. |
But #1902 is not merged and has test failures. |
🤭 I missed that. |
#1455 has shown that the Python target does not work correctly with the recently released Python version 3.11. We should update the generator and/or runtime to ensure compatibility with Python 3.11.
The text was updated successfully, but these errors were encountered: