Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

CPU hang while analyzing PyQt5 #875

Closed
jakebailey opened this issue Apr 3, 2019 · 16 comments
Closed

CPU hang while analyzing PyQt5 #875

jakebailey opened this issue Apr 3, 2019 · 16 comments
Assignees
Milestone

Comments

@jakebailey
Copy link
Member

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

@jakebailey jakebailey added this to the April 2019.1 milestone Apr 3, 2019
@jakebailey jakebailey self-assigned this Apr 3, 2019
@mhzed
Copy link

mhzed commented Apr 4, 2019

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.

@ahuigo
Copy link

ahuigo commented Apr 4, 2019

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.vscode-django@0.19.0
donjayamanne.jupyter@1.1.5
donjayamanne.python-extension-pack@1.4.0
magicstack.MagicPython@1.1.0
ms-python.python@2019.3.6215
ms-vscode.Go@0.9.2
ms-vsliveshare.vsliveshare@0.3.1403
msjsdiag.debugger-for-chrome@4.11.3
mushan.vscode-paste-image@1.0.4
Shan.code-settings-sync@3.2.7
tht13.python@0.2.3
VisualStudioExptTeam.vscodeintellicode@1.1.5
vscodevim.vim@1.3.0
wholroyd.jinja@0.0.8
yzane.markdown-pdf@1.2.0
yzhang.markdown-all-in-one@2.2.0

Related issue:
microsoft/vscode-python#5074

@MikhailArkhipov
Copy link

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

@ahuigo
Copy link

ahuigo commented Apr 4, 2019

@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?

@mhzed
Copy link

mhzed commented Apr 4, 2019

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

@ahuigo
Copy link

ahuigo commented Apr 4, 2019

@mhzed How to update it to 0.2.43.0 ?

@MikhailArkhipov
Copy link

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

@ahuigo
Copy link

ahuigo commented Apr 4, 2019

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.

@eyadsibai
Copy link

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

@ionlz
Copy link

ionlz commented Apr 6, 2019

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.

@MikhailArkhipov
Copy link

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.

@ahuigo
Copy link

ahuigo commented Apr 7, 2019

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

@MikhailArkhipov
Copy link

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.

@jakebailey
Copy link
Member Author

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!

@jakebailey
Copy link
Member Author

jakebailey commented Apr 8, 2019

Root cause appears to be #907.

EDIT: But not completely.

@jakebailey jakebailey changed the title 100% CPU usage during analysis of large conda environments CPU hang while analyzing PyQt5 Apr 15, 2019
@jakebailey
Copy link
Member Author

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants