Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Closed
saturday06 opened this issue May 9, 2025 · 3 comments · Fixed by #25070
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release

Comments

@saturday06
Copy link

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

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label May 9, 2025
@rreuvekamp
Copy link

Also affected.

Temporary fix:

pip3 install packaging

in your virtualenv

saturday06 added a commit to saturday06/VRM-Addon-for-Blender that referenced this issue May 9, 2025
@quitaiskiluisf
Copy link

Also affected.

Temporary fix:

pip3 install packaging

in your virtualenv

Worked for me, but only after I've updated pip itself:

python3 -m pip install --upgrade pip

@pierrebai-adsk
Copy link

I'm currently experiencing the same problem, reverting to 2025.4 also fixed it for me.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release needs PR Ready to be worked on and removed triage-needed Needs assignment to the proper sub-team labels May 14, 2025
@github-actions github-actions bot removed the needs PR Ready to be worked on label May 15, 2025
eleanorjboyd added a commit to eleanorjboyd/vscode-python that referenced this issue May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug regression Bug didn't exist in a previous release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants