Skip to content

Testing: Wrong python version or environment #25440

@SebKeb

Description

@SebKeb

Type: Bug

When trying to discover the tests in my repository it throws the following error. Apparently it doesnt activate python or my environment correctly.

2025-09-04 15:48:08.376 [info] Discover tests for workspace name: modelBuilder - uri: /fast/home/s-kebrich/modelBuilder
2025-09-04 15:48:08.392 [info] arg: --rootdir already exists in args, not adding.
2025-09-04 15:48:08.393 [info] Environment variables set for pytest discovery: PYTHONPATH=/fast/home/s-kebrich/.vscode-server/extensions/ms-python.python-2025.12.0-linux-x64/python_files:/fast/home/s-kebrich/modelBuilder, TEST_RUN_PIPE=/run/user/1140/python-test-discovery-0ae26b119b3916000a75
2025-09-04 15:48:08.403 [info] > conda run -p ~/miniforge3/envs/MB2Europe --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2025.12.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2025.12.0-linux-x64/python_files/printEnvVariables.py
2025-09-04 15:48:08.404 [info] shell: bash
2025-09-04 15:48:09.834 [info] > conda run -p ~/miniforge3/envs/MB2Europe --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2025.12.0-linux-x64/python_files/get_output_via_markers.py -m pytest -p vscode_pytest --collect-only tests --rootdir=.
2025-09-04 15:48:09.834 [info] cwd: .
2025-09-04 15:48:11.052 [info] >>>PYTHON-EXEC-OUTPUT

2025-09-04 15:48:11.446 [error] ImportError while loading conftest '/fast/home/s-kebrich/modelBuilder/tests/conftest.py'.

2025-09-04 15:48:11.472 [error] tests/conftest.py:5: in
from modelBuilder.singletons import ModelLocations,ModelPaths,ModelTechnoEconomicData,InputDataInfo
modelBuilder/init.py:7: in
from .esMWorkflowManager import *
modelBuilder/esMWorkflowManager.py:1: in

2025-09-04 15:48:11.472 [error] import geopandas as gpd
E ModuleNotFoundError: No module named 'geopandas'

2025-09-04 15:48:11.472 [info] <<<PYTHON-EXEC-OUTPUT

2025-09-04 15:48:11.514 [error] ERROR conda.cli.main_run:execute(33): Subprocess for 'conda run ['python', '/fast/home/s-kebrich/.vscode-server/extensions/ms-python.python-2025.12.0-linux-x64/python_files/get_output_via_markers.py', '-m', 'pytest', '-p', 'vscode_pytest', '--collect-only', 'tests', '--rootdir=/fast/home/s-kebrich/modelBuilder']' command failed. (See above for error)

2025-09-04 15:48:11.538 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace /fast/home/s-kebrich/modelBuilder.
2025-09-04 15:48:11.539 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace /fast/home/s-kebrich/modelBuilder. Creating and sending error discovery payload
2025-09-04 15:48:11.539 [error] pytest test discovery error for workspace: /fast/home/s-kebrich/modelBuilder

The python test process was terminated before it could exit on its own, the process errored with: Code: 4, Signal: null for workspace /fast/home/s-kebrich/modelBuilder

Trying to activate the environment in the terminal only works if the base environment is deactivated manually:
(base) [s-kebrich@iek3028 modelBuilder]$ conda activate /fast/home/s-kebrich/miniforge3/envs/MB2Europe
(MB2Europe) [s-kebrich@iek3028 modelBuilder]$ which python
/opt/ohpc/pub/apps/anaconda3/bin/python
(MB2Europe) [s-kebrich@iek3028 modelBuilder]$ mamba deactivate
(base) [s-kebrich@iek3028 modelBuilder]$ mamba deactivate
[s-kebrich@iek3028 modelBuilder]$ mamba activate MB2Europe
(MB2Europe) [s-kebrich@iek3028 modelBuilder]$ which python
~/miniforge3/envs/MB2Europe/bin/python
(MB2Europe) [s-kebrich@iek3028 modelBuilder]$

Discovering the tests in the terminal after manually deactivating base and activating the desired env works and the tests succesfully load.
In the free version of mobaXterm, activating the environment and sending the command "which python" also reveals the correct version.

VS Code version: Code 1.103.2 (6f17636121051a53c88d3e605c491d22af2ba755, 2025-08-20T16:45:34.255Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 4.18.0-477.15.1.el8_8.x86_64

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1265U (12 x 2688)
GPU Status 2d_canvas: enabled
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
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.44GB (12.95GB free)
Process Argv
Screen Reader no
VM 0%
Item Value
Remote SSH: iek3028.iek.kfa-juelich.de
OS Linux x64 4.18.0-477.15.1.el8_8.x86_64
CPUs Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz (72 x 3698)
Memory (System) 1006.10GB (644.81GB free)
VM 0%
Extensions (29)
Extension Author (truncated) Version
remotehub Git 0.64.0
jupyter-keymap ms- 1.1.2
remote-containers ms- 0.426.0
remote-ssh ms- 0.121.2025081515
remote-ssh-edit ms- 0.87.0
remote-wsl ms- 0.99.0
vscode-remote-extensionpack ms- 0.26.0
azure-repos ms- 0.40.0
remote-explorer ms- 0.5.0
remote-repositories ms- 0.42.0
remote-server ms- 1.5.2
docker doc 0.16.0
gitlens eam 17.4.1
copilot Git 1.364.0
copilot-chat Git 0.30.3
vscode-pull-request-github Git 0.116.2
gitlab-workflow Git 6.40.1
rainbow-csv mec 3.21.0
vscode-containers ms- 2.1.0
vscode-docker ms- 2.0.0
debugpy ms- 2025.11.2025072901
python ms- 2025.12.0
vscode-pylance ms- 2025.7.102
vscode-python-envs ms- 1.2.0
jupyter ms- 2025.7.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.3.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6

Metadata

Metadata

Assignees

Labels

triage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions