You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python debug breakpoint not working on (base) #710
Originally posted by bynkook August 29, 2021
VS Code Version: 1.59.1 (user setup)
OS Version: Windows 10 19H2
Steps to Reproduce:
Install Miniconda3
Install Vscode, python extension, activate conda (base)
Initial settings with default launch.json, run code in the screenshot with breakpoint. the breakpoint is not working
JustMyCode : false is tested. Not working.
Same test on two different clean machine which never installed python and vscode before.
the debug works fine when a virtual environment create with command such as "conda create -n venv python=3.9.6" Apparently it seems the trouble happens when user is activated (base) without any reason.
The path to the script being debugged is under C:\Users\...\Miniconda, which is also the base prefix of the Python interpreter if you use base. IIRC that will make your script be treated as if it were a part of the standard library - i.e. it won't be considered "your code" if you have Just My Code enabled (which is true by default). Try setting "justMyCode": false and see if that helps.
(If it is indeed the problem, I would recommend moving your scripts out of that folder. In general, it should only contain the Python implementation, its standard library, and any global packages that you have installed via conda or pip.)
The path to the script being debugged is under C:\Users\...\Miniconda, which is also the base prefix of the Python interpreter if you use base. IIRC that will make your script be treated as if it were a part of the standard library - i.e. it won't be considered "your code" if you have Just My Code enabled (which is true by default). Try setting "justMyCode": false and see if that helps.
(If it is indeed the problem, I would recommend moving your scripts out of that folder. In general, it should only contain the Python implementation, its standard library, and any global packages that you have installed via conda or pip.)
As i mentioned, JustMyCode solution is not working.
well i can not believe such simple 2 lined python code is requiring for a unprofessional user to modify internal configuration to set a breakpoint of debugging. anyway i attached the log files as instructed. I want to highlight that JustMyCode:False did not resolve the issue.
The path to the script being debugged is under C:\Users\...\Miniconda, which is also the base prefix of the Python interpreter if you use base. IIRC that will make your script be treated as if it were a part of the standard library - i.e. it won't be considered "your code" if you have Just My Code enabled (which is true by default). Try setting "justMyCode": false and see if that helps.
(If it is indeed the problem, I would recommend moving your scripts out of that folder. In general, it should only contain the Python implementation, its standard library, and any global packages that you have installed via conda or pip.)
Indeed all my .py files are under c:\Users[user]\Miniconda3\userspace, the sub folder i created.
Debug configuration keys are case-sensitive; you set "JustMyCode", but the actual key name is "justMyCode".
(Note that you wouldn't have to do this if you didn't keep your user code under C:\Users\...\Miniconda - then it would "just work".)
Now I can confirm the "justMyCode": false solution is working. Now I think outstanding issue is how to figure out basically why 2 line 'hello world' example is not debugging under conda (base) without adding the magic word.
This seems to be because of "justMyCode": true instead of "justMyCode": false in the launch configuration.
Do you really think the 2 line Hello World code is requiring custom modification to settings for a simple debugging? Is it intended?
So far, yes, it's intended... You're having problems because you're placing files inside of the directories reserved for conda, which is usually only meant for library directories, whereas most don't have problems because they create project files in directories that are not inside of conda.
I agree that having justMyCode be false by default would actually fix your problem, but there are arguments for having it as true by default (as it is now) too.
Your case could be supported if we implemented: #581 (but it's still not done and given other issues that still hasn't become a priority, so, there's no due date on it).
The simplest solution for your use case it probably moving your project files to a directory that's not considered a library directory (i.e.: move it out of the conda directories).
p.s.: closing issue as things are happening as intended.
Activity
fabioz commentedon Aug 30, 2021
Can you provide the logs (for both the case where it works and where it doesn't work)?
i.e.:
ms-python.python-2021.*.****int19h commentedon Aug 30, 2021
The path to the script being debugged is under
C:\Users\...\Miniconda, which is also the base prefix of the Python interpreter if you usebase. IIRC that will make your script be treated as if it were a part of the standard library - i.e. it won't be considered "your code" if you have Just My Code enabled (which is true by default). Try setting"justMyCode": falseand see if that helps.(If it is indeed the problem, I would recommend moving your scripts out of that folder. In general, it should only contain the Python implementation, its standard library, and any global packages that you have installed via
condaorpip.)bynkook commentedon Aug 31, 2021
As i mentioned, JustMyCode solution is not working.
bynkook commentedon Aug 31, 2021
I am uploading the *.log files as requested.
debugger.vscode_d624862d-063e-4b8e-b9da-571187ac3ca4.log
debugpy.adapter-14432.log
debugpy.launcher-19900.log
debugpy.pydevd.13940.log
debugpy.server-13940.log
fabioz commentedon Aug 31, 2021
The logs are showing:
"justMyCode": true,and thus:
sending cmd (http_json) --> CMD_RETURN {"type": "response", "request_seq": 8, "success": true, "command": "setBreakpoints", "body": {"breakpoints": [{"verified": false, "message": "Breakpoint in file excluded by filters.\nNote: may be excluded because of \"justMyCode\" option (default == true).Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).\n", "source": {"name": "0.py", "path": "c:\\Users\\bk3.lee\\Miniconda3\\userspace\\0.py"}, "line": 1}]}, "seq": 18, "pydevd_cmd_id": 502}Can you create a launch with
"justMyCode": false,and resend the logs where it doesn't work with that launch configuration?brettcannon commentedon Aug 31, 2021
bynkook for the log request.
bynkook commentedon Sep 1, 2021
well i can not believe such simple 2 lined python code is requiring for a unprofessional user to modify internal configuration to set a breakpoint of debugging. anyway i attached the log files as instructed. I want to highlight that JustMyCode:False did not resolve the issue.
debugger.vscode_62a670aa-580e-478f-aa0c-e718e6bf4c9e.log
debugpy.adapter-18436.log
debugpy.launcher-8812.log
debugpy.pydevd.10208.log
debugpy.server-10208.log
int19h commentedon Sep 1, 2021
Debug configuration keys are case-sensitive; you set "JustMyCode", but the actual key name is "justMyCode".
(Note that you wouldn't have to do this if you didn't keep your user code under
C:\Users\...\Miniconda- then it would "just work".)bynkook commentedon Sep 1, 2021
Indeed all my .py files are under c:\Users[user]\Miniconda3\userspace, the sub folder i created.
bynkook commentedon Sep 1, 2021
Now I can confirm the "justMyCode": false solution is working. Now I think outstanding issue is how to figure out basically why 2 line 'hello world' example is not debugging under conda (base) without adding the magic word.
bynkook commentedon Sep 7, 2021
Windows 10 19H2
Miniconda3 (3.9.7)
Vscode 1.59.1 portable
Python Extension v2021.9.1191016588
/conda create -n venv
/conda activate venv
After these, a breakpoint assigned, press F5, the terminal says it went back to (base) envionment and breakpoint not working.
debugger.vscode_3a66d6e3-9ba3-43eb-9a15-a2b6c30a7069.log
debugpy.adapter-12256.log
debugpy.launcher-17388.log
debugpy.pydevd.6456.log
debugpy.server-6456.log
fabioz commentedon Sep 7, 2021
This seems to be because of
"justMyCode": trueinstead of"justMyCode": falsein the launch configuration.bynkook commentedon Sep 7, 2021
Do you really think the 2 line Hello World code is requiring custom modification to settings for a simple debugging? Is it intended?
fabioz commentedon Sep 7, 2021
So far, yes, it's intended... You're having problems because you're placing files inside of the directories reserved for conda, which is usually only meant for library directories, whereas most don't have problems because they create project files in directories that are not inside of conda.
I agree that having
justMyCodebefalseby default would actually fix your problem, but there are arguments for having it as true by default (as it is now) too.Your case could be supported if we implemented: #581 (but it's still not done and given other issues that still hasn't become a priority, so, there's no due date on it).
The simplest solution for your use case it probably moving your project files to a directory that's not considered a library directory (i.e.: move it out of the conda directories).
p.s.: closing issue as things are happening as intended.
fabioz commentedon Sep 7, 2021
p.s.: Feel free to
+1#581 if you feel that support is interesting for you.