-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
The conda environment doesn't work with test explorer #19873
Comments
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 |
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?
related #10626 If that doesn't work, please change the setting |
Also, can you run
in VSCode terminal and send me the output. Make sure to expand |
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:: |
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 |
For the testing issue it seems we're not able to parse the arguments correctly when run in terminal as it looks like here: #19873 (comment) Reassigning as that's testing related. |
@xarpy Can you run the following command instead of #19873 (comment)?
|
@xarpy Also try to open a new terminal and install pytest again:
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
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
canvas_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
A/B Experiments
The text was updated successfully, but these errors were encountered: