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
When compiled, astropy.extern.ply.yacc.YaccError: Unable to build parser #15069
Comments
Well, at least we got past the coordinates import error for |
The person mentioned a piece of code in Nuitka/Nuitka#2313 that I believe was added in #11227 by @bmerry for thread-safety; so perhaps bmerry can shed some light on this? 🙏 |
I'm not familiar with Nuitka at all, but from glancing at the discussion, the code that's particularly problematic ( |
No solution yet, but some interesting facts that may help with debugging. I printed out the value of pdict after astropy/astropy/extern/ply/yacc.py line 3245. The value of pdict is slightly different depending on whether I'm running normal python or a bin compiled by Nuitka. Note that in the normal python method, tokens is defined towards the bottom, but this section is missing from the compiled bin version. Normal python use:
Combiled bin use:
Search for 'Timeout' in both error strings. (Timeout is not significant, but it gets you to the right place in the string. You can't search for a missing term.) Notice that the first significant deviation is for the value 'quit'. |
Alternate solution to consider: If Astropy is planning to update to the new version of Ply, we should probably wait for that upgrade before troubleshooting this. I looked into updating Ply and it is a bit over my head. I'm happy to help with this transition if this is likely a good solution, but I'm not going to dive in just yet. Update: I looked at the source code for the current Ply and its usage of get_caller_module_dict looks quite similar to the old code. |
#13399 has been open for a year, so I am not sure if it is high priority for us, especially when it is not trivial. |
I'm out of time to debug this. Unfortunately our solution for now is to not use the Astropy library. I do hope to come back at some point. |
Description
The problem was initial reported as part of #15028, but has a different root cause, so I'm making a separate ticket.
Expected behavior
I should be able to write code that uses Astropy, and compile my code using Nuitka.
How to Reproduce
Create minimalTest.py with the following text:
Confirm you got the fix for #15028. Should output 'hello world.'
python3 -OO minimalTest.py
This is only necessary until the fix is in the released version.
Install Nuitka.
Lines above can be replaced with
pip3 install nuitka
once the patch from Nuitka/Nuitka#2313 is in their release branch.Compile using Nuitka and run the resulting executable.
Output of minimalTest.bin:
This error message looks very similar to #10361, but I think the fix for 15037 should have resolved the related issue.
For those following the previous thread, Nuitka fixed their optimize flag problem, and that did not resolve my issue.
Kayhayen has some suggestions in this thread that I don't know exactly how to implement, but I'm not the best Python programmer: Nuitka/Nuitka#2313
Versions
Linux-5.18.7-1.el7.elrepo.x86_64-x86_64-with-glibc2.17
Python 3.9.10 (main, Jun 29 2023, 21:55:15)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
astropy 6.0.dev396+g7e9f51e (need this to get -OO fix, but get similar errors with stable release)
Numpy 1.25.0
pyerfa 2.0.0.3
Traceback (most recent call last):
File "/generator/Testing/minimalTest.py", line 9, in
import scipy; print("Scipy", scipy.version)
ModuleNotFoundError: No module named 'scipy'
The text was updated successfully, but these errors were encountered: