Skip to content

"ModuleNotFoundError: No module named 'packaging'" occurs when running unit tests #25044

Closed
@saturday06

Description

@saturday06

Type: Bug

Behaviour

When attempting to run unit tests, the execution aborts with the following exception:

Traceback (most recent call last):
  File "/home/vscode/.vscode-server/extensions/ms-python.python-2025.6.0-linux-x64/python_files/unittestadapter/execution.py", line 15, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'
Finished running tests!

The python extension version 2025.4.0 works fine.

Steps to reproduce:

  1. create unittest
from unittest import TestCase


class TestFoo(TestCase):
    def test_foo(self) -> None:
        self.assertTrue(True, "True!")
  1. Right-click on test_foo on the source code.
  2. Press "Run Test at Cursor"
  3. Error occurred.

Extension version: 2025.6.0
VS Code version: Code 1.100.0 (19e0f9e681ecb8e5c09d8784acaa601316ca4571, 2025-05-07T12:48:53.763Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2
Remote OS version: Linux x64 5.15.167.4-microsoft-standard-WSL2

  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.3
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• unittestEnabled: true

Installed Extensions
Extension Name Extension Id Version
autopep8 ms- 2025.2.0
debugpy ms- 2025.8.0
js-debug ms- 1.100.0
python ms- 2025.6.0
vscode-eslint dba 3.0.10
vscode-js-profile-table ms- 1.0.10
vscode-pylance ms- 2025.4.1
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13650HX (20 x 2803)
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
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.71GB (41.44GB free)
Process Argv --crash-reporter-id 8dfc9b73-8651-4035-b62d-16aa1889c3ce
Screen Reader no
VM 0%
Item Value
Remote Dev Container: VRM-Addon-for-Blender
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs 13th Gen Intel(R) Core(TM) i7-13650HX (20 x 0)
Memory (System) 31.20GB (28.45GB free)
VM 0%
Item Value
Remote Dev Container
OS Linux x64 5.15.167.4-microsoft-standard-WSL2
CPUs 13th Gen Intel(R) Core(TM) i7-13650HX (20 x 0)
Memory (System) 31.20GB (28.45GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dwnewjupyter:31046869
pythonrstrctxt:31112756
nativeloc2:31192216
5fd0e150:31155592
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
e5gg6876:31282496
pythoneinst12:31285622
bgtreat:31268568
4gafe986:31271826
31787653:31262186
3e8i5726:31271747
996jf627:31283433
pythonrdcb7:31303018
usemplatestapi:31297334
7bj51361:31289155
747dc170:31275177
g20af354:31278749
pylancecolorcf:31303817
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
gendocf:31295004

Metadata

Metadata

Assignees

Labels

area-testingbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions