2025-10-20 12:54:38.840 [info] Running installed packages checker: {
id: '/Users/username/anaconda3/envs/my_conda_env/bin/python',
displayName: 'my_conda_env (3.12.11)',
detailedDisplayName: 'my_conda_env',
envType: 'Conda',
envPath: '/Users/username/anaconda3/envs/my_conda_env',
type: 'Conda',
path: '/Users/username/anaconda3/envs/my_conda_env/bin/python',
version: {
raw: '3.12.11',
major: 3,
minor: 12,
patch: 11,
build: [],
prerelease: []
},
sysVersion: '3.12.11',
architecture: 3,
sysPrefix: '/Users/username/anaconda3/envs/my_conda_env'
} /Users/username/.vscode/extensions/ms-python.python-2025.16.0-darwin-arm64/python_files/installed_check.py /Users/username/Source/my_project/pyproject.toml
2025-10-20 12:54:38.840 [info] > ~/anaconda3/envs/my_conda_env/bin/python ~/.vscode/extensions/ms-python.python-2025.16.0-darwin-arm64/python_files/installed_check.py ./pyproject.toml
2025-10-20 12:56:03.065 [info] Discover tests for workspace name: my_project - uri: /Users/username/Source/my_project
2025-10-20 12:56:03.073 [info] arg: --rootdir already exists in args, not adding.
2025-10-20 12:56:03.073 [info] Environment variables set for pytest discovery: PYTHONPATH=/Users/username/.vscode/extensions/ms-python.python-2025.16.0-darwin-arm64/python_files, TEST_RUN_PIPE=/var/folders/7b/j6zzgg8j1v3d83xn_msb1xnw0000gn/T/python-test-discovery-59c4eedeb9119bd3c322
2025-10-20 12:56:03.253 [error] ImportError while loading conftest '/Users/username/Source/my_project/tests/conftest.py'.
2025-10-20 12:56:03.277 [error] tests/conftest.py:36: in <module>
from qgis.core import (
E ModuleNotFoundError: No module named 'qgis'
2025-10-20 12:56:03.297 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace /Users/username/Source/project_name
2025-10-20 12:56:03.297 [error] pytest test discovery error for workspace: /Users/username/Source/project_name
The python test process was terminated before it could exit on its own, the process errored with: Code: 4, Signal: null for workspace /Users/username/Source/project_name
Type: Bug
Behavior
Pytest test discovery fails, reporting a missing import. The relevant package exists and is on the PYTHONPATH in my conda environment, but the python extension resets the
PYTHONPATHto/Users/username/.vscode/extensions/ms-python.python-2025.16.0-darwin-arm64/python_fileswhen it runs test discovery (and perhaps also tests, but I can't get that far). Running from the command line works fine.This is a new problem -- not sure exactly when it started but I was not having it in September, so maybe with the most recent version.
Steps to reproduce:
$CONDA_PREFIX/share/python)PYTHONPATHto the location of the package in the conda environement (e.g., usingconda env config vars)Diagnostic data
Output for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)Extension version: 2025.16.0
VS Code version: Code 1.105.1 (7d842fb85a0275a4a8e4d7e040d2625abbf7f084, 2025-10-14T22:33:36.618Z)
OS version: Darwin arm64 24.6.0
Modes:
python.languageServersetting: DefaultUser Settings
Installed Extensions
System Info
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: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments