Closed xarpy closed 1 year ago
Seeing as you can run it manually, it might be an issue with the debugger not being able to attach to your miniconda interpreter, or because your code isn't being recognised as your own because you're running it with miniconda. Try debugging with 'justMyCode': false
and see if that works. If so, this may be a duplicate of #19871.
Hi @EzraEn1 , one of the approaches suggested in some comments was to downgrade to previous versions of the ms-python package, to version v2022.2.1924087327, This solved my problem partially, but I will test with these recommendations and try to understand the scenarios better.
Hi @EzraEn1 and @karrtikr , the solution with this property does not work, because vsocde does not work in debug mode with the last update and conda, but if you change to the previous version of the ms-python package, as I suggested in the last post, it works, however now tests do not work anymore!
I am currently using the latest version of conda, 22.9.0, but still no success.
Hey @DonJayamanne , any suggestions?
This might be that when run in VS Code it is not running in a activated environment. Can you try this?
cd
to your workspace.conda activate
code .
related #10626
If that doesn't work, please change the setting terminal.integrated.inheritEnv
to false
as outlined in https://code.visualstudio.com/updates/v1_36#_launch-terminals-with-clean-environments.
Also, can you run
conda run -n project_name --no-capture-output --live-stream python ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py pytest -- --rootdir . -s --cache-clear
in VSCode terminal and send me the output. Make sure to expand ~
.
This might be that when run in VS Code it is not running in a activated environment. Can you try this?
- Anaconda prompt and
cd
to your workspace.- Activate the environment using
conda activate
- Start VS Code using
code .
related #10626
If that doesn't work, please change the setting
terminal.integrated.inheritEnv
tofalse
as outlined in https://code.visualstudio.com/updates/v1_36#_launch-terminals-with-clean-environments.
Hi @karrtikr, I followed these steps but was not successful, see the recording below, when I tried running vscode with conda enabled manually and accessing the project folder with vscode from the terminal::
Also, can you run
conda run -n project_name --no-capture-output --live-stream python ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py pytest -- --rootdir . -s --cache-clear
in VSCode terminal and send me the output. Make sure to expand
~
.
conda run -n project_name --no-capture-output --live-stream python ~/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/testing_tools/run_adapter.py pytest -- --rootdir . -s --cache-clear
>>>PYTHON-EXEC-OUTPUT
usage: /home/xarpy/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/testing_tools/run_adapter.py
[-h] {discover} ...
/home/xarpy/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/testing_tools/run_adapter.py: error: argument cmd: invalid choice: 'pytest' (choose from 'discover')
<<<PYTHON-EXEC-OUTPUT
ERROR conda.cli.main_run:execute(49): `conda run python /home/xarpy/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/get_output_via_markers.py /home/xarpy/.vscode/extensions/ms-python.python-2022.16.0/pythonFiles/testing_tools/run_adapter.py pytest -- --rootdir . -s --cache-clear` failed. (See above for error)
But if I run it in the old version, as talked about earlier, the debugger works but the tests don't, only if they are run manually from the terminal.
Debugger doesn't work as we no longer support debugging for Python below 3.7
, please upvote https://github.com/microsoft/vscode-python/issues/19559 if you would like to see us bring it back.
For the testing issue it seems we're not able to parse the arguments correctly when run in terminal as it looks like here: https://github.com/microsoft/vscode-python/issues/19873#issuecomment-1275464096
Reassigning as that's testing related.
@xarpy Can you run the following command instead of https://github.com/microsoft/vscode-python/issues/19873#issuecomment-1271942780?
conda run -n project_name --no-capture-output --live-stream python ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.14.0/pythonFiles/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear
@xarpy Also try to open a new terminal and install pytest again:
python -m pip install pytest
Ensure conda environment is activated before the above command is run, should look something similar to:
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.
Type: Bug
Behaviour
I participated in some projects that use python version 2.7 and the Pyramid framework. As all my environments are managed through miniconda3, I just create the specific environments for each project from their requirements.
However, I have noticed some instability in the vscode to be able to debug some projects, which use python, since 2 last updates.
Now during some routine tests, as I always had the habit of running the debugger and creating breakpoints, as well as running the tests from the editor, I'm not succeeding anymore.
This my launch.json for the project reference:
Trying to run the debugger I can't get any kind of output, but running the Plugin Test Explorer UI + Python Test Explorer, which always worked before, now doesn't work!
Please note that I can activate the python environments created by conda normally from vscode, as well as run all the tests in a terminal:
When running debugpy command with conda run in terminal, for test if conda find the module and package to execute:
Expected vs. Actual
XXX
Steps to reproduce:
Diagnostic data
python.languageServer
setting: PylanceUser Settings
``` condaPath: ""
languageServer: "Pylance"
linting
• flake8Args: ""
• flake8Enabled: true
formatting
• autopep8Args: ""
testing
• pytestEnabled: true
• autoTestDiscoverOnSaveEnabled: false
```
Extension version: 2022.14.0 VS Code version: Code 1.71.2 (74b1f979648cc44d385a2286793c226e611f59e7, 2022-09-14T21:12:14.256Z) OS version: Linux x64 5.15.0-48-generic Modes: Sandboxed: No
System Info
|Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 x 2300)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 0, 0| |Memory (System)|15.48GB (8.83GB free)| |Process Argv|--unity-launch --crash-reporter-id af58d562-3f25-41a2-a7ce-ababeb5e1431| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11|
A/B Experiments
``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492:30256859 vstes627:30244334 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30557514 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 hb751961:30553087 dsvsc012cf:30540253 azure-dev_surveyone:30548225 2144e591:30553903 fc301958:30573243 ```