Python-language-server: CPU hang while analyzing PyQt5

Created on 3 Apr 2019  Â·  16Comments  Â·  Source: microsoft/python-language-server

import pandas as pd 
import datetime 
import pandas_datareader.data as web

start = datetime.datetime(2010, 1,1)
end = datetime.datetime.now()
df = web.DataReader("MSFT", "yahoo", start, end)



df.set_index("Date", inplace = True)

import matplotlib.pyplot as plt
from matplotlib import style

style.use('fivethirtyeight')


df['High'].plot()

plt.legend()
plt.show()

With:

requirements.txt

performance

All 16 comments

Similar issue here, it stays at 100% forever "Analyzing in background, xxx items left". This started happening after updating to version "2019.3.6352". Seems though it picked up the virtual env and got stuck analyzing the site-packages.

Same 100% cpu issue with my small project:

  1. It has been analyzing forever when I open vscode from code bin: \
    /usr/local/bin/code -> /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
    image
  2. It always remind me to enable pylint every time even through I have enabled pylint.
  3. Here is screen shot from Development Tools:
    image
    image

Environment data

With Python 3.7.2 installed:
```
vscode 1.32.3
Mac Mojave 10.14
pylint 2.3.1
astroid 2.2.5
Python 3.7.2 (default, Feb 12 2019, 08:15:36)

➜ pydemo$ code --list-extensions --show-versions
batisteo.[email protected]
donjayamanne.[email protected]
donjayamanne.[email protected]
magicstack.[email protected]
ms-python.[email protected]
ms-vscode.[email protected]
ms-vsliveshare.[email protected]
msjsdiag.[email protected]
mushan.[email protected]
Shan.[email protected]
tht13.[email protected]
VisualStudioExptTeam.[email protected]
vscodevim.[email protected]
wholroyd.[email protected]
yzane.[email protected]
yzhang.[email protected]
````
Related issue:
https://github.com/Microsoft/vscode-python/issues/5074

@ahuigo, @mhzed - what is the LS version (displayed at startup in the output). 0.2.43 is latest.

@MikhailArkhipov languageServer.0.2.41

[Extension Host] Python Extension: Get language server folder name, Class name = g, , Return Value: "languageServer.0.2.41"

Any more should I provide?

Mine was 0.2.41.0
Just updated to 0.2.43.0 and now the problem appears to be gone.

@mhzed How to update it to 0.2.43.0 ?

Delete languageServer.* folder under extension (use Open Extensions Folder command)

mv /Users/ahui/.vscode/extensions/ms-python.python-2019.3.6352/languageServer.0.2.41 ~/backup

Remove 0.2.41 and updated to 0.2.43, the problem disappears now.

it fixes the problem temporarily, it starts again after opening/closing couple of projects

I still have this problem that high CPU usage.And if i enable pylint, the vscode will take up a lot of memory.
I have removed 0.2.41.

It depends on what your code imports. For example, a single tensorflow import effectively means 3000 files to be analyzed. Which takes CPU cycles. Although we are working on additional optimizations and caching, in some cases there is little way around the fact that some libraries are very big with circular imports.

If I import nodejs and golang directory , will it analyze node_modules and go files?

No, of course not. Only py, pyd and other related Python files unless there are stubs, in which case the stubs are used rather than the library source.

This thread is about CPU usage, if you believe you have a different issue we'd appreciate it if you could make another thread so we can handle it separately. Thanks!

Root cause appears to be #907.

EDIT: But not completely.

The hang that I was investigating in this issue appears to be fixed now that #942 is merged; we still analyze all of PyQt5 which takes a few seconds, but it's no longer taking minutes.

If there are other examples where the analysis appears to not complete then they should go into another issue (as I'd like to close this specific item as done).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qubitron picture qubitron  Â·  6Comments

jakebailey picture jakebailey  Â·  4Comments

rsalunga29 picture rsalunga29  Â·  5Comments

melwas picture melwas  Â·  5Comments

jakebailey picture jakebailey  Â·  4Comments