Skip to content

High CPU on starting pylance from get_pytest_options.py #4218

@ethanh20009

Description

@ethanh20009

Environment data

  • Language Server version: 2023.4.11
  • OS and version: win32 x64
  • Python version (and distribution if applicable, e.g. Anaconda): Python 3.10.9 Anaconda
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: off

Code Snippet

Repro Steps

  1. Install anaconda (and thus python)
  2. install vscode, python extension pack.
  3. create folder, open with vscode
  4. create ipynb file
  5. open window.
  6. observe python thread in task manager using high cpu resources, won't stop until force kill or close vscode.

Expected behavior

Having vscode does not cause high cpu usage.

Actual behavior

Vscode open with python extension causes constant 25% CPU usage from ghost python threads.

Temporary found solution (not a proper fix)

If I comment out from C:\Users\ethan.vscode\extensions\ms-python.vscode-pylance-2023.4.11\dist\bundled\files get_pytest_options.py

#c = get_config()
#c.parse(sys.argv)
#print(f"Python classes: {c.getini('python_classes')}")
#print(f"Python files: {c.getini('python_files')}")
#print(f"Python functions: {c.getini('python_functions')}")

Pylance still works and the issue no longer remains for me.

I am very new to this sort of issue fixing and I know this is not a proper fix
Please advise on a proper fix for this.

Logs

[Info  - 8:41:39 PM] (3676) Pylance language server 2023.4.11 (pyright 64a33975) starting
[Info  - 8:41:39 PM] (3676) Server root directory: c:\Users\ethan\.vscode\extensions\ms-python.vscode-pylance-2023.4.11\dist
[Info  - 8:41:39 PM] (3676) Starting service instance "LemonadeStand"
[Info  - 8:41:39 PM] (3676) Auto-indent enabled
[Info  - 8:41:39 PM] (3676) Setting pythonPath for service "LemonadeStand": "C:\ProgramData\Anaconda3\python.exe"
[Info  - 8:41:40 PM] (3676) Assuming Python version 3.10
[Info  - 8:41:40 PM] (3676) Found 3 source files
[Info  - 8:41:40 PM] (3676) Background analysis(1) root directory: c:\Users\ethan\.vscode\extensions\ms-python.vscode-pylance-2023.4.11\dist
[Info  - 8:41:40 PM] (3676) Background analysis(1) started
[Info  - 8:42:03 PM] (3676) Indexer background runner(2) root directory: c:\Users\ethan\.vscode\extensions\ms-python.vscode-pylance-2023.4.11\dist (index)
[Info  - 8:42:03 PM] (3676) Indexing(2) started
[Info  - 8:42:04 PM] (3676) scanned(2) 466 files over 1 exec env
[Info  - 8:42:10 PM] (3676) [IDX(2)] Long operation: index execution environment c:\Users\ethan\Documents\Python\Jupyter\AI\LemonadeStand (5756ms)
[Info  - 8:42:10 PM] (3676) [IDX(2)] Long operation: index packages c:\Users\ethan\Documents\Python\Jupyter\AI\LemonadeStand (5771ms)
[Info  - 8:42:10 PM] (3676) indexed(2) 292 files over 1 exec env
[Info  - 8:42:10 PM] (3676) Indexing finished(2).

Full logs attached as .txt
pylanceLog.txt

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixed in next version (main)A fix has been implemented and will appear in an upcoming version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions