-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
VSCode with Python 3.11.05a+: Warning message when starts #213
Comments
Well, the paths being reported by CPython are wrong in this case (they're relative instead of absolute), so, it's a CPython regression probably... This is the 2nd report about that (the first one is in debugpy: microsoft/debugpy#847). There's not much I can do about it, this needs to be fixed in CPython (the debugger already works around it, but it notifies users so that they know there's something wrong in the Python version being used). |
@fabioz, CPython core dev here. Can you help us track this down? I tried to run the reproducer script posted in http://bugs.python.org/issue1666807 but I could not trigger the issue, so something else seems to be wrong. At the very least the error message is misleading (since the problem is not the same as in the bpo issue linked). In 3.11 quite a few internals of code objects (and other aspects of the interpreter) that might be of interest to pydevd have changed, so is it possible that changes to pydev might need to be made? |
Hi @gvanrossum hehe, quite a core dev ;) I must say I also don't really know what happens, all I know is that doing:
Is returning a relative path and not an absolute path as it should. I agree the error message is misleading (this check was done back when that bug was rampant, but that bug is probably not applicable anymore and does raise confusion). I'll fix that in the debugger (reopening to improve the error message). |
Ah, that particular module is "frozen" (which is a hack to speed up startup), and its filename shows as You can disable frozen modules (except for some bootstrap code in importlib) by passing |
Humm, will standard modules will be frozen by default? (i.e.: is it opt in or opt out?) I guess that the debugger needs to pass |
Only a few modules that are always loaded at startup (the list is here: https://github.com/python/cpython/blob/main/Python/frozen.c, generated here: https://github.com/python/cpython/blob/main/Tools/scripts/freeze_modules.py), though there are requests for a larger set. Definitely not the whole stdlib though.
That would make sense. We could try to patch the filename on each individual code object but that would waste time and memory we're trying to save at startup. I wonder if you could parse the string (Also, I believe this is actually specific to deep-frozen modules. "Classic" frozen modules go through marshal which patches co_filename. But they're going out of style except for bootstrapping.) |
That seems like a reasonable workaround in this case if the module file points to the proper file even though the code object doesn't. |
FWIW a better description of the older issue is here: https://bugs.python.org/issue1180193. At the time the problem happened when the PYC file was generated in one location but then PY and PYC files were moved elsewhere. The patch there updates the co_filename attributes in-memory after they have been read. It was applied to 2.6+ and 3.0+ so the problem was essentially solved -- until deep-freezing caused it to pop up again. I would recommend passing the -X flag over parsing the |
Thanks, I think I'll just omit the bug reference as those versions aren't even supported anymore.
Agreed. |
The error message was improved in: 74aa8fa Better support for Python 3.11 frozen modules will be done when microsoft/debugpy#861 is tackled. |
A workaround is to add this to the configuation in launch.json:
|
@gvanrossum FYI the error message is correct from version 2022.4.1
A PR is submitted (see microsoft/debugpy#937) |
Python 3.11.0
This did not fix it:
Full VSCode launch.json:
Not sure if this is relevant, but the warning disappears if I comment out the multiprocessing call:
|
I don't know why this is 'closed' when it has not been fixed, but I wanted someone to know that I got this error message on PyCharm today, so the error is not limited to vsCode. My os is Ubuntu 22.04 LTS. I downloaded this Python from deadsnakes. With respect to the workaround, is that something I am supposed to run every time I invoke Python, or is it 'once for all'? Either way, it is not working for me: `
Maybe this line goes somewhere else in PyCharm, but I don't know where that place would be. I assume the point was that the test would not pass, but as you can see, it does for me. Please advise. Thanks. |
@MalikRumi This issue has been resolved in PyCharm 2022.3. In 2022.2 the workaround was to put Hope that helps... |
@douglatornell can you spell it out a bit more in detail how to set "Interpreter options" ? |
I hope this screenshot helps, @lsmith77. |
-Xfrozen_modules=off This hasn't worked for me. Do you have any other suggestions thanks? |
When I put Running
What's interesting about this is My launch config:
|
This debuggy issue explains the source of the second It does not, however, explain why I still get the warning. |
I still get this warning trying to debug a FastAPI app invoked with Uvicorn: {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: FastAPI",
"type": "python",
"request": "launch",
"module": "uvicorn",
"pythonArgs": [
"-Xfrozen_modules=off"
],
"args": [
"my_app:app",
"--reload"
],
"jinja": true,
"justMyCode": true
}
]
} I'm on Python 3.11.2. Any advice? |
Try registering together |
When running the debugger of VSCode with Python 3.11.05a, this message prints:
This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: http://bugs.python.org/issue1666807
And the related link is a very old issue (more than a decade)
My configuration is:
The text was updated successfully, but these errors were encountered: