microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.34k stars 1.19k forks source link

Pixi errror when loading pytest in VS code #23773

Closed adam-lagoda closed 2 weeks ago

adam-lagoda commented 4 months ago

Type: Bug

Behaviour

I get a pytest discovery error when starting pytest from the vs code testing window. The systems utilizes micromamba as the python package manager, with an alias set up between conda -> micromamba. The error originates from pixi not being found,

Steps to reproduce:

  1. Use micromamba environment that is activated in powershell
  2. Open VSCode and the testing toolbar (with the Python Extension set to 2024.10.0)
  3. Tests will not be discovered

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

``` XXX ```

Extension version: 2024.10.0 VS Code version: Code 1.91.0 (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:52:22.949Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

User Settings

``` condaPath: "" languageServer: "Pylance" testing • pytestArgs: "" • pytestEnabled: true ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |autoDocstring - Python Docstring Generator|njpwerner.autodocstring|0.6.1| |CodeSnap|adpyke.codesnap|1.3.4| |CSV to Table|phplasma.csv-to-table|1.4.0| |Data Wrangler|ms-toolsai.datawrangler|1.4.1| |FindItFaster|TomRijndorp.find-it-faster|0.0.38| |Git Graph|mhutchie.git-graph|1.30.0| |GitLens — Git supercharged|eamodio.gitlens|15.1.0| |Hex Editor|ms-vscode.hexeditor|1.10.0| |JavaScript Debugger|ms-vscode.js-debug|1.91.0| |json|ZainChen.json|2.0.2| |Jupyter|ms-toolsai.jupyter|2024.6.0| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.18| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Live Preview|ms-vscode.live-server|0.4.13| |Path Intellisense|christian-kohler.path-intellisense|2.9.0| |Pretty Formatter|mblode.pretty-formatter|0.2.4| |Pylance|ms-python.vscode-pylance|2024.6.1| |Python|ms-python.python|2024.11.2024070801| |Python Debugger|ms-python.debugpy|2024.6.0| |Rainbow CSV|mechatroner.rainbow-csv|3.12.0| |SQLite|alexcvzz.vscode-sqlite|0.14.1| |SVG|jock.svg|1.5.4| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Todo Tree|Gruntfuggly.todo-tree|0.0.226|
System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|23.71GB (5.42GB free)| |Process Argv|--folder-uri=vscode-remote://wsl+Ubuntu-22.04/home/adam/Documents/Git/QUIET --remote=wsl+Ubuntu-22.04| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.153.1-microsoft-standard-WSL2| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 0)| |Memory (System)|11.54GB (9.78GB free)| |VM|0%|
adam-lagoda commented 4 months ago

image

rafrafek commented 4 months ago

I have the same issue that started occurring after the latest VS Code Python extension update. I use Poetry to create my virtual environments, and I don't even know what Pixi is.

I'm getting a "pytest Discovery Error" and am unable to launch any tests in VS Code.

adam-lagoda commented 4 months ago

I have tested that downgrading to v2024.8.1 works @rafrafek. However this is a temporary solution, and I would highly appreciate fixing the bug by the core team

rafrafek commented 4 months ago

My logs:

2024-07-09 14:41:13.122 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonTestAdapter' is active
2024-07-09 14:41:13.122 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/Users/username/Projects/project-name/.pixi/envs'
    at Object.readdirSync (node:fs:1515:3)
    at t.readdirSync (node:electron/js2c/node_init:2:11289)
    at /Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574598
    at /Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574789
    at Array.map (<anonymous>)
    at d.initWatchers (/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574507)
    at async d.ensureWatchersReady (/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:536827)] {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/username/Projects/project-name/.pixi/envs'
}
2024-07-09 14:41:13.122 [error] Dir "/Users/username/Projects/project-name/.pixi/envs" is not watchable (directory does not exist)
2024-07-09 14:41:13.154 [info] Default formatter is set to null for workspace /Users/username/Projects/project-name
2024-07-09 14:41:13.157 [info] Python interpreter path: ./.venv/bin/python
2024-07-09 14:41:13.282 [info] > pyenv which python
2024-07-09 14:41:13.282 [info] cwd: .
2024-07-09 14:41:13.915 [info] > pixi --version
2024-07-09 14:41:13.916 [error] [Error: spawn pixi ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn pixi',
  path: 'pixi',
  spawnargs: [ '--version' ]
}
2024-07-09 14:41:13.916 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.487 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.497 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py
2024-07-09 14:41:14.497 [info] shell: bash
2024-07-09 14:41:14.527 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.528 [info] > ./.venv/bin/python -m pytest -p vscode_pytest --collect-only tests
2024-07-09 14:41:14.528 [info] cwd: .
2024-07-09 14:41:14.657 [error] Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 192, in console_main
    code = main()
           ^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 150, in main

2024-07-09 14:41:14.658 [error] config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 331, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/helpconfig.py", line 104, in pytest_cmdline_parse
    config: Config = outcome.get_result()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])

2024-07-09 14:41:14.658 [error]   File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1075, in pytest_cmdline_parse

2024-07-09 14:41:14.658 [error]     self.parse(args)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1425, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1301, in _preparse

2024-07-09 14:41:14.659 [error]     self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 709, in consider_preparse

2024-07-09 14:41:14.659 [error]     self.consider_pluginarg(parg)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 735, in consider_pluginarg

2024-07-09 14:41:14.659 [error]     self.import_plugin(arg, consider_entry_points=True)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 781, in import_plugin

2024-07-09 14:41:14.659 [error]     __import__(importspec)

2024-07-09 14:41:14.659 [error]   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 186, in exec_module
    exec(co, module.__dict__)
  File "/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/vscode_pytest/__init__.py", line 895, in <module>
    class DeferPlugin:
  File "/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin
    @pytest.hookimpl(wrapper=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HookimplMarker.__call__() got an unexpected keyword argument 'wrapper'

2024-07-09 14:41:14.676 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/username/Projects/project-name.
2024-07-09 14:41:14.677 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/username/Projects/project-name. Creating and sending error discovery payload
2024-07-09 14:41:14.677 [error] pytest test discovery error for workspace:  /Users/username/Projects/project-name 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/username/Projects/project-name
eleanorjboyd commented 4 months ago

Hi! What version of pytest are you using? It might be due to you being on a older version and updating might fix your problem.

rafrafek commented 4 months ago

Hi! I'm using version 7.4.4, and updating to the latest version 8.2.2 fixed the issue in my case. I'm not the author of this issue, though, so I would wait to confirm if it helps in that case.

paulf81 commented 4 months ago

I have also had this issue

jk1man1 commented 4 months ago

I had the same problem. It seems that having the pytest verion 7.4.4, and updating to the latest version 8.2.2, fixed the issue on my end

adam-lagoda commented 4 months ago

I have now checked my environment package versions, and I had pytest running also running on 7.4.4, however, as @jk1man1 and @rafrafek pointed out, 8.2.2 works out of the box. I have also tested, and 7.4.0 works as well. I am therefore closing this issue, as not relevant for vscode-python

Ivanli-RT commented 4 months ago

My logs:

2024-07-09 14:41:13.122 [info] Experiment 'pythonCreateEnvOnPipInstall' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-07-09 14:41:13.122 [info] Experiment 'pythonTestAdapter' is active
2024-07-09 14:41:13.122 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/Users/username/Projects/project-name/.pixi/envs'
  at Object.readdirSync (node:fs:1515:3)
  at t.readdirSync (node:electron/js2c/node_init:2:11289)
  at /Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574598
  at /Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574789
  at Array.map (<anonymous>)
  at d.initWatchers (/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:574507)
  at async d.ensureWatchersReady (/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/out/client/extension.js:2:536827)] {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/Users/username/Projects/project-name/.pixi/envs'
}
2024-07-09 14:41:13.122 [error] Dir "/Users/username/Projects/project-name/.pixi/envs" is not watchable (directory does not exist)
2024-07-09 14:41:13.154 [info] Default formatter is set to null for workspace /Users/username/Projects/project-name
2024-07-09 14:41:13.157 [info] Python interpreter path: ./.venv/bin/python
2024-07-09 14:41:13.282 [info] > pyenv which python
2024-07-09 14:41:13.282 [info] cwd: .
2024-07-09 14:41:13.915 [info] > pixi --version
2024-07-09 14:41:13.916 [error] [Error: spawn pixi ENOENT
  at ChildProcess._handle.onexit (node:internal/child_process:286:19)
  at onErrorNT (node:internal/child_process:484:16)
  at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn pixi',
  path: 'pixi',
  spawnargs: [ '--version' ]
}
2024-07-09 14:41:13.916 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.487 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.497 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/printEnvVariables.py
2024-07-09 14:41:14.497 [info] shell: bash
2024-07-09 14:41:14.527 [warning] could not find a pixi interpreter for the interpreter at /Users/username/Projects/project-name/.venv/bin/python
2024-07-09 14:41:14.528 [info] > ./.venv/bin/python -m pytest -p vscode_pytest --collect-only tests
2024-07-09 14:41:14.528 [info] cwd: .
2024-07-09 14:41:14.657 [error] Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 192, in console_main
    code = main()
           ^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 150, in main

2024-07-09 14:41:14.658 [error] config = _prepareconfig(args, plugins)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 331, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/helpconfig.py", line 104, in pytest_cmdline_parse
    config: Config = outcome.get_result()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])

2024-07-09 14:41:14.658 [error]   File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1075, in pytest_cmdline_parse

2024-07-09 14:41:14.658 [error]     self.parse(args)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1425, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1301, in _preparse

2024-07-09 14:41:14.659 [error]     self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 709, in consider_preparse

2024-07-09 14:41:14.659 [error]     self.consider_pluginarg(parg)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 735, in consider_pluginarg

2024-07-09 14:41:14.659 [error]     self.import_plugin(arg, consider_entry_points=True)
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/config/__init__.py", line 781, in import_plugin

2024-07-09 14:41:14.659 [error]     __import__(importspec)

2024-07-09 14:41:14.659 [error]   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "/Users/username/Projects/project-name/.venv/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 186, in exec_module
    exec(co, module.__dict__)
  File "/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/vscode_pytest/__init__.py", line 895, in <module>
    class DeferPlugin:
  File "/Users/username/.vscode/extensions/ms-python.python-2024.10.0-darwin-arm64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin
    @pytest.hookimpl(wrapper=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: HookimplMarker.__call__() got an unexpected keyword argument 'wrapper'

2024-07-09 14:41:14.676 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/username/Projects/project-name.
2024-07-09 14:41:14.677 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/username/Projects/project-name. Creating and sending error discovery payload
2024-07-09 14:41:14.677 [error] pytest test discovery error for workspace:  /Users/username/Projects/project-name 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/username/Projects/project-name

my error log is all the same

eleanorjboyd commented 4 months ago

Hi, seems like this is actually this error: https://github.com/microsoft/vscode-python/issues/23707 and therefore a duplicate. I am putting in a fix hopefully today for it. Lmk if you aren't seeing this error and are seeing something else and I can reopen thank you!

rafrafek commented 4 months ago

If someone wants to stay on Pytest version 7.x, can just bump pluggy https://pypi.org/project/pluggy/ to version 1.5.0.

https://github.com/microsoft/vscode-python/issues/23707#issuecomment-2216837312

garganpaull commented 4 months ago

Ive got the same problem which started today. Am using Python 3.10.6, pytest-8.2.2, pluggy-1.5.0.

[warning] could not find a pixi interpreter for the interpreter at c:\venv\Scripts\python.exe ... File "c:\venv\lib\site-packages\pluggy_manager.py", line 211, in unregister assert name is not None, "plugin is not registered" AssertionError: plugin is not registered

The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace

eleanorjboyd commented 4 months ago

@garganpaull are you trying to use pixi?

garganpaull commented 4 months ago

@garganpaull are you trying to use pixi?

No. I dont even know what Pixi is.

My colleague does not have this issue and is running Pytest version is 7.2.0, Python version is 3.10.2 using VS Code v1.86.2.

Im using VS Code 1.91.1, Python 3.10.6, pytest-8.2.2, pluggy-1.5.0.

This issue only started for me yesterday when I upgraded my VS Code

loomanss commented 4 months ago

my steps to a solution:

ended up with pytest 8.2.2 pluggy 1.5.0

jepManalo commented 4 months ago

I am actually also encountering this pixi error on my VS Code after the update. Right now, pytest Discovery is displaying errors that I have never seen before.

My current Versions are: pytest 7.2.2 pytest bdd 7.1.2 pluggy 1.0.0 VSCode 1.91.1 python 3.8.10

Here is the complete error:

`2024-07-12 15:09:10.914 [info] Experiment 'pythonaacf' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonCreateEnvOnPipInstall' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonTestAdapter' is active 2024-07-12 15:09:10.915 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir 'c:\.pixi\envs' at Object.readdirSync (node:fs:1515:3) at t.readdirSync (node:electron/js2c/node_init:2:11289) at c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574598 at c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574789 at Array.map () at d.initWatchers (c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574507) at async d.ensureWatchersReady (c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:536827)] { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: 'c:\\.pixi\envs' } 2024-07-12 15:09:10.915 [error] Dir "c:\.pixi\envs" is not watchable (directory does not exist) 2024-07-12 15:09:10.915 [info] Default formatter is set to null for workspace c:\ 2024-07-12 15:09:10.958 [info] Python interpreter path: ..venv\Scripts\python.exe 2024-07-12 15:09:11.763 [info] > pyenv which python 2024-07-12 15:09:11.763 [info] cwd: . 2024-07-12 15:09:11.848 [info] > conda info --json 2024-07-12 15:09:12.491 [info] > pixi --version 2024-07-12 15:09:12.511 [error] [Error: spawn pixi ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { errno: -4058, code: 'ENOENT', syscall: 'spawn pixi', path: 'pixi', spawnargs: [ '--version' ] } 2024-07-12 15:09:12.512 [warning] could not find a pixi interpreter for the interpreter at c:\.venv\Scripts\python.exe 2024-07-12 15:09:12.803 [info] > & ./.venv/Scripts/Activate.ps1 ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:12.803 [info] shell: powershell 2024-07-12 15:09:14.207 [info] Discover tests for workspace name: - uri: c:\ 2024-07-12 15:09:14.207 [info] Running discovery for pytest using the new test adapter. 2024-07-12 15:09:14.231 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path. 2024-07-12 15:09:14.233 [warning] could not find a pixi interpreter for the interpreter at c:\.venv\Scripts\python.exe 2024-07-12 15:09:14.562 [info] > ./.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:14.562 [info] shell: commandPrompt 2024-07-12 15:09:14.841 [info] > C:\ProgramData\anaconda3\Scripts\conda.exe info --json 2024-07-12 15:09:15.309 [info] > ~\AppData\Local\Programs\Python\Python38\python.exe ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:15.309 [info] shell: powershell 2024-07-12 15:09:15.312 [warning] could not find a pixi interpreter for the interpreter at c:\.venv\Scripts\python.exe 2024-07-12 15:09:15.335 [info] > ..venv\Scripts\python.exe -m pytest -p vscode_pytest --collect-only . 2024-07-12 15:09:15.335 [info] cwd: . 2024-07-12 15:09:15.417 [info] Starting Pylance language server. 2024-07-12 15:09:16.116 [info] Prepending environment variable PATH in collection with c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\deactivate\powershell;C:\.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-12 15:09:16.116 [info] Setting environment variable VIRTUAL_ENV in collection to C:\.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-12 15:09:16.909 [error] Traceback (most recent call last): File "C:\Users\\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:\.venv\lib\site-packages\pytest__main.py", line 5, in raise SystemExit(pytest.console_main()) File "c:\.venv\lib\site-packages_pytest\config__init.py", line 189, in console_main code = main() File "c:\.venv\lib\site-packages_pytest\config__init__.py", line 147, in main config = _prepareconfig(args, plugins) File "c:\.venv\lib\site-packages_pytest\config\init__.py", line 328, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "c:\.venv\lib\site-packages\pluggy_hooks.py", line 265, in call return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) File "c:\.venv\lib\site-packages\pluggy_manager.py", line 80, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "c:\.venv\lib\site-packages\pluggy_callers.py", line 55, in _multicall gen.send(outcome) File "c:\.venv\lib\site-packages_pytest\helpconfig.py", line 103, in pytest_cmdline_parse config: Config = outcome.get_result() File "c:\.venv\lib\site-packages\pluggy_result.py", line 60, in get_result raise ex[1].with_traceback(ex[2]) File "c:\.venv\lib\site-packages\pluggy_callers.py", line 39, in _multicall res = hook_impl.function(*args) File "c:\.venv\lib\site-packages_pytest\config__init.py", line 1075, in pytest_cmdline_parse self.parse(args) File "c:\.venv\lib\site-packages_pytest\config__init.py", line 1425, in parse self._preparse(args, addopts=addopts) File "c:\.venv\lib\site-packages_pytest\config__init.py", line 1301, in _preparse self.pluginmanager.consider_preparse(args, exclude_only=False) File "c:\.venv\lib\site-packages_pytest\config\init__.py", line 710, in consider_preparse self.consider_pluginarg(parg) File "c:\.venv\lib\site-packages_pytest\config\init__.py", line 736, in consider_pluginarg self.import_plugin(arg, consider_entry_points=True) File "c:\.venv\lib\site-packages_pytest\config\init__.py", line 782, in import_plugin import__(importspec) File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "c:\.venv\lib\site-packages_pytest\assertion\rewrite.py", line 178, in exec_module exec(co, module.dict) File "c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\vscode_pytest__init.py", line 895, in class DeferPlugin: File "c:\Users\.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\vscode_pytest\init.py", line 896, in DeferPlugin @pytest.hookimpl(wrapper=True) TypeError: call__() got an unexpected keyword argument 'wrapper'

2024-07-12 15:09:16.987 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:\. 2024-07-12 15:09:16.987 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:\. Creating and sending error discovery payload 2024-07-12 15:09:16.987 [error] pytest test discovery error for workspace: c:\

The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace c:\ `

zljubisic commented 4 months ago

I can report the same problem. In my output log I can find: 2024-07-16 12:15:12.324 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/home/path_to_the_project/.pixi/envs'

Apart from it, I can also find this in my output log:

2024-07-16 12:18:22.351 [info] INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/_pytest/main.py", line 271, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0

2024-07-16 12:18:22.351 [info] INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/_pytest/main.py", line 324, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_callers.py", line 181, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_result.py", line 99, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/_pytest/main.py", line 335, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/_pytest/main.py", line 677, in perform_collect
INTERNALERROR>     self.config.pluginmanager.check_pending()
INTERNALERROR>   File "/local/miniconda3/envs/<project_name>/lib/python3.11/site-packages/pluggy/_manager.py", line 384, in check_pending
INTERNALERROR>     raise PluginValidationError(
INTERNALERROR> pluggy._manager.PluginValidationError: unknown hook 'pytest_xdist_auto_num_workers' in plugin <vscode_pytest.DeferPlugin object at 0x7f1936d327d0>

I don't know if it is related to pixi.

garganpaull commented 3 months ago

@garganpaull are you trying to use pixi?

No. I dont even know what Pixi is.

My colleague does not have this issue and is running Pytest version is 7.2.0, Python version is 3.10.2 using VS Code v1.86.2.

Im using VS Code 1.91.1, Python 3.10.6, pytest-8.2.2, pluggy-1.5.0.

This issue only started for me yesterday when I upgraded my VS Code

Is this fixed yet as problem still persists.

rafrafek commented 3 months ago

I'm using VS Code 1.91.1, Python 3.10.6, pytest-8.2.2, pluggy-1.5.0.

Can you try with Python 3.10.14? Python 3.10.6 is 2 years old and there were many fixes between 3.10.6 and 3.10.14.

toddsayersshell commented 3 months ago

Also having this issue. I have no idea about or intention to use Pixi.

toddsayersshell commented 3 months ago

Dir "/workspaces/EARL-CAPEX-API/.pixi/envs" is not watchable (directory does not exist)

This is untrue; I explicitly created that path... and yet the error persists.

pluggy 1.5.0 pytest 8.2.2 pytest-cov 5.0.0 Python 3.9.2 (required by my project)

Linux e0655aa2f2f5 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 GNU/Linux

clement-chaneching commented 3 months ago

Hello,

I am also having the same error but I am willing to use pixi:

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /HOME/path/testclement/forecasting/forecasting
2024-08-07 15:35:42.896 [warning] could not find a pixi interpreter for the interpreter at /HOME/path/.pixi/envs/default/bin/python
2024-08-07 15:35:42.061 [error] 
EnvironmentLocationNotFound: Not a conda environment: /HOME/mambaforge/envs/default

2024-08-07 15:35:42.198 [info] Send text to terminal: /HOME/mambaforge/bin/conda install --name default pytest -y
2024-08-07 15:35:42.522 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /HOME/path.
2024-08-07 15:35:42.522 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /HOME/path. Creating and sending error discovery payload
2024-08-07 15:35:42.535 [error] pytest test discovery error for workspace:  /HOME/path 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /HOME/path
2024-08-07 15:35:42.896 [warning] could not find a pixi interpreter for the interpreter at /HOME/path
2024-08-07 15:35:42.919 [info] > ~/mambaforge/bin/conda run -n default --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.12.2-linux-x64/python_files/get_output_via_markers.py -c "import pytest"

It says it cannot find pixi interpreter, but I actually have pixi installed and setup as my python interpreter.

oldgithubman commented 2 months ago

Same error here and this is the first I've heard of pixi

jepManalo commented 2 months ago

I am actually also encountering this pixi error on my VS Code after the update. Right now, pytest Discovery is displaying errors that I have never seen before.

My current Versions are: pytest 7.2.2 pytest bdd 7.1.2 pluggy 1.0.0 VSCode 1.91.1 python 3.8.10

Here is the complete error:

`2024-07-12 15:09:10.914 [info] Experiment 'pythonaacf' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonCreateEnvOnPipInstall' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonRecommendTensorboardExt' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonTerminalEnvVarActivation' is active 2024-07-12 15:09:10.915 [info] Experiment 'pythonTestAdapter' is active 2024-07-12 15:09:10.915 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir 'c:.pixi\envs' at Object.readdirSync (node:fs:1515:3) at t.readdirSync (node:electron/js2c/node_init:2:11289) at c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574598 at c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574789 at Array.map () at d.initWatchers (c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:574507) at async d.ensureWatchersReady (c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\out\client\extension.js:2:536827)] { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: 'c:\.pixi\envs' } 2024-07-12 15:09:10.915 [error] Dir "c:.pixi\envs" is not watchable (directory does not exist) 2024-07-12 15:09:10.915 [info] Default formatter is set to null for workspace c: 2024-07-12 15:09:10.958 [info] Python interpreter path: ..venv\Scripts\python.exe 2024-07-12 15:09:11.763 [info] > pyenv which python 2024-07-12 15:09:11.763 [info] cwd: . 2024-07-12 15:09:11.848 [info] > conda info --json 2024-07-12 15:09:12.491 [info] > pixi --version 2024-07-12 15:09:12.511 [error] [Error: spawn pixi ENOENT at ChildProcess._handle.onexit (node:internal/child_process:286:19) at onErrorNT (node:internal/child_process:484:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] { errno: -4058, code: 'ENOENT', syscall: 'spawn pixi', path: 'pixi', spawnargs: [ '--version' ] } 2024-07-12 15:09:12.512 [warning] could not find a pixi interpreter for the interpreter at c:.venv\Scripts\python.exe 2024-07-12 15:09:12.803 [info] > & ./.venv/Scripts/Activate.ps1 ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:12.803 [info] shell: powershell 2024-07-12 15:09:14.207 [info] Discover tests for workspace name: - uri: c: 2024-07-12 15:09:14.207 [info] Running discovery for pytest using the new test adapter. 2024-07-12 15:09:14.231 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path. 2024-07-12 15:09:14.233 [warning] could not find a pixi interpreter for the interpreter at c:.venv\Scripts\python.exe 2024-07-12 15:09:14.562 [info] > ./.venv/Scripts/activate.bat && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:14.562 [info] shell: commandPrompt 2024-07-12 15:09:14.841 [info] > C:\ProgramData\anaconda3\Scripts\conda.exe info --json 2024-07-12 15:09:15.309 [info] > ~\AppData\Local\Programs\Python\Python38\python.exe ~/.vscode/extensions/ms-python.python-2024.10.0-win32-x64/python_files/printEnvVariables.py 2024-07-12 15:09:15.309 [info] shell: powershell 2024-07-12 15:09:15.312 [warning] could not find a pixi interpreter for the interpreter at c:.venv\Scripts\python.exe 2024-07-12 15:09:15.335 [info] > ..venv\Scripts\python.exe -m pytest -p vscode_pytest --collect-only . 2024-07-12 15:09:15.335 [info] cwd: . 2024-07-12 15:09:15.417 [info] Starting Pylance language server. 2024-07-12 15:09:16.116 [info] Prepending environment variable PATH in collection with c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\deactivate\powershell;C:.venv\Scripts; {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-12 15:09:16.116 [info] Setting environment variable VIRTUAL_ENV in collection to C:.venv {"applyAtShellIntegration":true,"applyAtProcessCreation":true} 2024-07-12 15:09:16.909 [error] Traceback (most recent call last): File "C:\Users\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:.venv\lib\site-packages\pytestmain.py", line 5, in raise SystemExit(pytest.console_main()) File "c:.venv\lib\site-packages_pytest\configinit.py", line 189, in console_main code = main() File "c:.venv\lib\site-packages_pytest\configinit.py", line 147, in main config = _prepareconfig(args, plugins) File "c:.venv\lib\site-packages_pytest\configinit.py", line 328, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "c:.venv\lib\site-packages\pluggy_hooks.py", line 265, in call return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) File "c:.venv\lib\site-packages\pluggy_manager.py", line 80, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "c:.venv\lib\site-packages\pluggy_callers.py", line 55, in _multicall gen.send(outcome) File "c:.venv\lib\site-packages_pytest\helpconfig.py", line 103, in pytest_cmdline_parse config: Config = outcome.get_result() File "c:.venv\lib\site-packages\pluggy_result.py", line 60, in get_result raise ex[1].with_traceback(ex[2]) File "c:.venv\lib\site-packages\pluggy_callers.py", line 39, in _multicall res = hook_impl.function(*args) File "c:.venv\lib\site-packages_pytest\configinit.py", line 1075, in pytest_cmdline_parse self.parse(args) File "c:.venv\lib\site-packages_pytest\configinit.py", line 1425, in parse self._preparse(args, addopts=addopts) File "c:.venv\lib\site-packages_pytest\configinit.py", line 1301, in _preparse self.pluginmanager.consider_preparse(args, exclude_only=False) File "c:.venv\lib\site-packages_pytest\configinit.py", line 710, in consider_preparse self.consider_pluginarg(parg) File "c:.venv\lib\site-packages_pytest\configinit.py", line 736, in consider_pluginarg self.import_plugin(arg, consider_entry_points=True) File "c:.venv\lib\site-packages_pytest\configinit.py", line 782, in import_plugin import(importspec) File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "c:.venv\lib\site-packages_pytest\assertion\rewrite.py", line 178, in exec_module exec(co, module.dict) File "c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\vscode_pytestinit.py", line 895, in class DeferPlugin: File "c:\Users.vscode\extensions\ms-python.python-2024.10.0-win32-x64\python_files\vscode_pytestinit.py", line 896, in DeferPlugin @pytest.hookimpl(wrapper=True) TypeError: call() got an unexpected keyword argument 'wrapper'

2024-07-12 15:09:16.987 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:. 2024-07-12 15:09:16.987 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace c:. Creating and sending error discovery payload 2024-07-12 15:09:16.987 [error] pytest test discovery error for workspace: c:

The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace c: `

I was able to fix this by upgrading pytest to the latest version. I suggest everyone who is encountering this do it too.

eleanorjboyd commented 2 months ago

@anthonykim1, could you circle around on this as you have made fixes in this area? Thanks!

anthonykim1 commented 2 months ago

You won't see the --version as error nor "2024-07-16 12:15:12.324 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/home/path_to_the_project/.pixi/envs'". Try clearing the output and downloading the latest version of Python extension. Related: https://github.com/microsoft/vscode-python/pull/23942

bernardo-suez commented 2 months ago

I have upgraded from pytest 8.3.2 to 8.3.3 but still have the same warning, which I believe is preventing Python/pytest to find packages in my data environment---see log below. This issue started yesterday, probably after an update (I don't recall if the update was yesterday or the day before). Downgreading the Python extension to 2024.12.3 (version I had last week when things were working) didn't help.

2024-09-11 09:25:55.537 [warning] could not find a pixi interpreter for the interpreter at C:\Users\btrindad\AppData\Local\anaconda3\envs\data\python.exe
2024-09-11 09:25:55.570 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-11 09:25:55.570 [info] cwd: .
2024-09-11 09:25:57.457 [info] ============================= test session starts =============================
platform win32 -- Python 3.11.5, pytest-7.4.0, pluggy-1.0.0

2024-09-11 09:25:57.465 [info] rootdir: c:\Users\btrindad\Desktop\BUs\VWPA\harrisburg-hyd-model-calibration
plugins: anyio-3.5.0

2024-09-11 09:26:04.318 [info] collected 18 items / 2 errors

<Package tests>

2024-09-11 09:26:04.318 [info]   <Module test_calibration_plotter.py>
    <Function test_initialization>
    <Function test_process_model_tank_results>
    <Function test_process_model_flow_results>
    <Function test_process_model_results>
    <Function test_plot_calibration>
    <Function test_group_sum_flows>
    <Function test_calc_calib_error>
    <Function test_plot_calibration_deviations>
  <Module test_outlier_replacement.py>
    <Function test_with_valid_inputs>
    <Function test_with_no_outliers>
    <Function test_with_non_existent_columns>
    <Function test_with_specific_time_ranges>
    <Function test_with_invalid_time_ranges>
    <Function test_with_valid_dataframe>
    <Function test_with_empty_dataframe>
    <Function test_with_non_datetime_index>
    <Function test_with_different_quantile_and_multiplier>
    <Function test_with_missing_data>

2024-09-11 09:26:04.383 [error] pytest test discovery error for workspace:  c:\Users\btrindad\Desktop\BUs\VWPA\harrisburg-hyd-model-calibration 
 _pytest.nodes.Collector.CollectError: ImportError while importing test module 'c:\Users\btrindad\Desktop\BUs\VWPA\harrisburg-hyd-model-calibration\tests\test_ccb_downscaler.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\..\..\..\AppData\Local\anaconda3\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\test_ccb_downscaler.py:4: in <module>
    from typeguard import TypeCheckError
E   ModuleNotFoundError: No module named 'typeguard'
 Check Python Test Logs for more details.

_pytest.nodes.Collector.CollectError: ImportError while importing test module 'c:\Users\btrindad\Desktop\BUs\VWPA\harrisburg-hyd-model-calibration\tests\test_water_distribution_tool.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
..\..\..\..\AppData\Local\anaconda3\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\test_water_distribution_tool.py:4: in <module>
    from shapely import Polygon
E   ModuleNotFoundError: No module named 'shapely'
 Check Python Test Logs for more details.

Interrupted: 2 errors during collection
 Check Python Test Logs for more details.
toddsayersshell commented 2 months ago

@bernardo-suez Your errors do not appear to be related to this issue. I'm not attempting to defend Github or Microsoft (I'm pretty annoyed with them, TBH). However...

You appear to have problem with your PYTHONPATH and/or how you are attempting to import packages. This appears to be unrelated to the Pixi errors we're describing, here.

EDIT: Ah... I do see that the very first line mentions the Pixi issue. Honestly... I've given up on the GH/MS dev team. I just have to ignore that error. The OTHER errors are unrelated. Also... Windows??? Level-up, yo...

oldgithubman commented 2 months ago

Also... Windows??? Level-up, yo...

Wake me up when Linux has proper HDR support

(I do main Linux though)

zljubisic commented 2 months ago

@eleanorjboyd can you please help us solving this issue? After blocking automatic update and downgrading vscode and python extension - pytest works. Are mine versions of vscode/python last working versions or we will be able to upgrade them again in the future?

zljubisic commented 2 months ago

You won't see the --version as error nor "2024-07-16 12:15:12.324 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/home/path_to_the_project/.pixi/envs'". Try clearing the output and downloading the latest version of Python extension. Related: https://github.com/[/pull/23942](https://github.com/microsoft/vscode-python/pull/23942)

@anthonykim1 I can confirm that the issue is still present in vscode:

Version: 1.93.0 (user setup)
Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
Date: 2024-09-04T13:02:38.431Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

And python extension v2024.14.1

$ pytest --version
pytest 8.3.3

From python output:

...
2024-09-14 15:28:56.260 [info] > ~/miniconda3/bin/conda run -n state_machine --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/printEnvVariables.py
2024-09-14 15:28:56.260 [info] shell: bash
2024-09-14 15:28:57.879 [info] > pixi --version
2024-09-14 15:28:57.880 [warning] could not find a pixi interpreter for the interpreter at /home/zoran/miniconda3/envs/state_machine/bin/python
2024-09-14 15:28:57.886 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-14 15:28:57.886 [info] cwd: .
2024-09-14 15:28:57.914 [error] /home/zoran/miniconda3/bin/python: No module named pytest

2024-09-14 15:28:57.933 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine.
2024-09-14 15:28:57.933 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine. Creating and sending error discovery payload
2024-09-14 15:28:57.933 [error] pytest test discovery error for workspace:  /home/zoran/state_machine 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/zoran/state_machine

If I run pytest directly from integrated terminal, everything works:

$ pytest --collect-only
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 1 item                                                                                                                                                                                                                                         

<Dir state_machine>
  <Dir tests>
    <Module test_example.py>
      <Function test_bla>

=============================================================================================================== 1 test collected in 8.04s ================================================================================================================

After reloading window I can see that pytest is now not accessible from vscode:

2024-09-14 15:39:35.866 [info] shell: bash
2024-09-14 15:39:36.827 [info] > pixi --version
2024-09-14 15:39:36.828 [warning] could not find a pixi interpreter for the interpreter at /home/zoran/miniconda3/envs/state_machine/bin/python
2024-09-14 15:39:36.839 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-14 15:39:36.839 [info] cwd: .
2024-09-14 15:39:36.863 [error] /home/zoran/miniconda3/bin/python: No module named pytest

2024-09-14 15:39:36.876 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine.
2024-09-14 15:39:36.876 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine. Creating and sending error discovery payload
2024-09-14 15:39:36.876 [error] pytest test discovery error for workspace:  /home/zoran/state_machine 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/zoran/state_machine

But I can access it from integrated terminal. I can confirm that proper interpreter is selected (from state_machine).

$ pytest --collect-only
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 2 items                                                                                                                                                                                                                                        

<Dir state_machine>
  <Dir tests>
    <Module test_example.py>
      <Function test_bla>
      <Function test_bla2>

=============================================================================================================== 2 tests collected in 0.04s ===============================================================================================================
(state_machine) (base) zoran@WSL:~/state_machine main
$ pytest
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 2 items                                                                                                                                                                                                                                        

tests/test_example.py ..                                                                                                                                                                                                                           [100%]

=================================================================================================================== 2 passed in 8.38s ====================================================================================================================
(state_machine) (base) zoran@WSL:~/state_machine main

Probably we have multiple problems here, but problem exists.

Hint: It is enough to downgrade python extension to v2024.9.1 and everything works.

thethiny commented 2 months ago

Error still exists 17/Sep/2024

zljubisic commented 2 months ago

Error still exists 17/Sep/2024

They closed the issue?

oldgithubman commented 2 months ago

Error still exists 17/Sep/2024

They closed the issue?

Wow

toddsayersshell commented 2 months ago

Closed -- this is what I expect from Microsoft. I would have expected testing before releasing from Github... but, hey, Microsoft gonna Microsoft.

thethiny commented 2 months ago

The irony in expecting testing in a testing functionality

zljubisic commented 2 months ago

And what now? To open a new issue and ask to reopen this one? @eleanorjboyd can we avoid it?

anatesan-stream commented 1 month ago

You won't see the --version as error nor "2024-07-16 12:15:12.324 [error] Reading directory to watch failed [Error: ENOENT: no such file or directory, scandir '/home/path_to_the_project/.pixi/envs'". Try clearing the output and downloading the latest version of Python extension. Related: https://github.com/[/pull/23942](https://github.com/microsoft/vscode-python/pull/23942)

@anthonykim1 I can confirm that the issue is still present in vscode:

Version: 1.93.0 (user setup)
Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
Date: 2024-09-04T13:02:38.431Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

And python extension v2024.14.1

$ pytest --version
pytest 8.3.3

From python output:

...
2024-09-14 15:28:56.260 [info] > ~/miniconda3/bin/conda run -n state_machine --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/printEnvVariables.py
2024-09-14 15:28:56.260 [info] shell: bash
2024-09-14 15:28:57.879 [info] > pixi --version
2024-09-14 15:28:57.880 [warning] could not find a pixi interpreter for the interpreter at /home/zoran/miniconda3/envs/state_machine/bin/python
2024-09-14 15:28:57.886 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-14 15:28:57.886 [info] cwd: .
2024-09-14 15:28:57.914 [error] /home/zoran/miniconda3/bin/python: No module named pytest

2024-09-14 15:28:57.933 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine.
2024-09-14 15:28:57.933 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine. Creating and sending error discovery payload
2024-09-14 15:28:57.933 [error] pytest test discovery error for workspace:  /home/zoran/state_machine 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/zoran/state_machine

If I run pytest directly from integrated terminal, everything works:

$ pytest --collect-only
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 1 item                                                                                                                                                                                                                                         

<Dir state_machine>
  <Dir tests>
    <Module test_example.py>
      <Function test_bla>

=============================================================================================================== 1 test collected in 8.04s ================================================================================================================

After reloading window I can see that pytest is now not accessible from vscode:

2024-09-14 15:39:35.866 [info] shell: bash
2024-09-14 15:39:36.827 [info] > pixi --version
2024-09-14 15:39:36.828 [warning] could not find a pixi interpreter for the interpreter at /home/zoran/miniconda3/envs/state_machine/bin/python
2024-09-14 15:39:36.839 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-14 15:39:36.839 [info] cwd: .
2024-09-14 15:39:36.863 [error] /home/zoran/miniconda3/bin/python: No module named pytest

2024-09-14 15:39:36.876 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine.
2024-09-14 15:39:36.876 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /home/zoran/state_machine. Creating and sending error discovery payload
2024-09-14 15:39:36.876 [error] pytest test discovery error for workspace:  /home/zoran/state_machine 

 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /home/zoran/state_machine

But I can access it from integrated terminal. I can confirm that proper interpreter is selected (from state_machine).

$ pytest --collect-only
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 2 items                                                                                                                                                                                                                                        

<Dir state_machine>
  <Dir tests>
    <Module test_example.py>
      <Function test_bla>
      <Function test_bla2>

=============================================================================================================== 2 tests collected in 0.04s ===============================================================================================================
(state_machine) (base) zoran@WSL:~/state_machine main
$ pytest
================================================================================================================== test session starts ===================================================================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/zoran/state_machine
configfile: pyproject.toml
collected 2 items                                                                                                                                                                                                                                        

tests/test_example.py ..                                                                                                                                                                                                                           [100%]

=================================================================================================================== 2 passed in 8.38s ====================================================================================================================
(state_machine) (base) zoran@WSL:~/state_machine main

Probably we have multiple problems here, but problem exists.

Hint: It is enough to downgrade python extension to v2024.9.1 and everything works.

Downgrading Python extension to v2024.9.1 did not work for me either. Other version info from VSCode

Version: 1.93.1 (user setup) Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 Date: 2024-09-11T17:20:05.685Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.22631

anthonykim1 commented 1 month ago

Probably we have multiple problems here, but problem exists.

@zljubisic You are probably right. It seems like mix of couple problems and confusions. Let's try to solve this puzzle one by one - that being said I'm putting up a PR to change log level on this pixi warning to see and hoping it will clear up things. https://github.com/microsoft/vscode-python/pull/24164/files this way pixi warnings won't be screaming at you even when you are irrelevant (you don't have pixi nor do not intend to use one)

Can't connect the dots between how pixi warning is related to pytest at the moment.

@clement-chaneching If you are still suffering from your pixi environment not being discovered, you can file a separate issue. Give https://github.com/microsoft/vscode-python/issues/23975#issuecomment-2306443372 a read for your pixi specific related problems though.

@toddsayersshell FYI It is not Microsoft who closed this issue.

Thanks

zljubisic commented 1 month ago

@anthonykim1 thanks for your reply. PR you have mentioned will help us not to see pixi warning, but problem with pytest discovery within vscode remains. Which issue will track that? If the issue is this one, we could ask @adam-lagoda to reopen it (if possible).

adam-lagoda commented 1 month ago

Downgrading the Python Extension initially has worked for me. Right now I am running v2024.14.1 and VSCode 1.93.1 without issues

oldgithubman commented 1 month ago

Closed -- this is what I expect from Microsoft. I would have expected testing before releasing from Github... but, hey, Microsoft gonna Microsoft.

Censored -- also what I expect from microsoft

eleanorjboyd commented 1 month ago

this issue seems related with the incorrect environment being selected for python when testing: https://github.com/microsoft/vscode-python/issues/24122

zljubisic commented 1 month ago

Downgrading the Python Extension initially has worked for me. Right now I am running v2024.14.1 and VSCode 1.93.1 without issues

Because of poor microsoft testing before releasing an new vscode, I am really afraid to upgrade anything. It used to be ok in the past, but lately it is realy bad. I hope they will enforce better quality control. This is especially true related to pytest.

oldgithubman commented 1 month ago

Downgrading the Python Extension initially has worked for me. Right now I am running v2024.14.1 and VSCode 1.93.1 without issues

Because of poor microsoft testing before releasing an new vscode, I am really afraid to upgrade anything. It used to be ok in the past, but lately it is realy bad. I hope they will enforce better quality control. This is especially true related to pytest.

Thoughts on pycharm?

toddsayersshell commented 1 month ago

Thoughts on pycharm?

I have a colleague that uses Pycharm. It's quite a bit more robust. It's... arguably better than VScode. HOWEVER... when you consider that VScode is a glorified web page (Electron app)... it's more impressive than anything I'll ever build. Moreover, Pycharm is not free. VScode IS "free." I suspect that I simply don't understand the cost (surely they're getting something from us... or will).

Now, I detest Microsoft. I ditched Windows in the 90s... and my life has been so much better. That said... VScode is one of the best things they've built (granted, using OSS componentry). It's truly cross-platform. And if you use it atop a real OS (e.g., Linux)... well, it's a solid experience across Linux/Windoze/Mac. I had bad luck using WSL2 (possibly due to corporate updates/etc)... but I've been happy running it against a Docker installation running in a VirtualBox/Ubuntu VM.

I don't believe that you're making a fair comparison. If you don't mind paying for Pycharm... from what I've seen, it IS better than VScode. Alas... VScode is generally "good enough" for me. It's just annoying when they break things. I believe that their corporate culture/etc is lacking. They KEEP reintroducing problems. But, well, it's free. I'm admittedly unjustifiably grumpy about their failings/bugs -- mostly because they seem to hit at the worst time.

If you need a solid product that cannot fail (and that has commercial support for when it does)... well, you might want to pay for that. Complaining is free, you know...

oldgithubman commented 1 month ago

Pycharm is not free.

The community version is

I don't believe that you're making a fair comparison.

I didn't compare anything. I just asked for thoughts. Thanks for sharing yours. Are there any other good alternatives?

anatesan-stream commented 1 month ago

For what it's worth, on my Linux container on a Chromebook, Pycharm started slowing down very significantly as my Python project grew in size.

I ended up switching to VSCode and all my IDE-specific memory/performance problems went away overnight.

I was using the Community version of Pycharm.

Thanks & regards Ashok Natesan Cell: 669-333-4692

Streamlinity LLC https://www.streamlinity.com

On Thu, Sep 26, 2024 at 11:42 AM Old Man @.***> wrote:

Pycharm is not free.

The community version is

I don't believe that you're making a fair comparison.

I didn't compare anything. I just asked for thoughts. Thanks for sharing yours. Are there any other good alternatives?

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-python/issues/23773#issuecomment-2377675708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5KD2E7P3D3Y45HAJI6ZCDZYRIRPAVCNFSM6AAAAABKSVHEEWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZXGY3TKNZQHA . You are receiving this because you commented.Message ID: @.***>

karthiknadig commented 1 month ago

We are actively investigating this. The short answer is, we are not able to isolate the issue. If we can't isolate it, we may have to revert pixi support. We want to avoid reverting pixi support which is a community contributed feature.

If you are running into this, and it is blocking, pin the extension to a previous version.

I will be marking anything that does not directly help us address this issue as off topic. I understand the frustration, we are investigating this. Off-topic comments are not helpful to get us to resolving this issue.