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

Language Server Analysis Time in Conda Environment #821

Closed
Anapo14 opened this issue Mar 25, 2019 · 12 comments
Closed

Language Server Analysis Time in Conda Environment #821

Anapo14 opened this issue Mar 25, 2019 · 12 comments

Comments

@Anapo14
Copy link
Contributor

Anapo14 commented Mar 25, 2019

VSCode Version: 1.32.3
Extension Version: 2019.2.5558
OS: Windows 10
Python 3.7.2
LS Version: 0.2.30.0
Using Conda virtual environment

I have a conda environment that includes the list of packages in this attachment. However, it take the LS 17 minutes to complete analysis on this environment.

image

(Note the time that analysis starts and the time on my computer's clock...the screenshot was taken before analysis was fully completed).

I am working with this simple script:

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.reset_index(inplace = True )
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()
@luabud
Copy link
Member

luabud commented Mar 25, 2019

For me it didn't take long, but this is what I got on the output window:

Starting Microsoft Python language server. [Info - 10:08:03 AM] GetCurrentSearchPaths C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\python.exe [Info - 10:08:03 AM] Python search paths: [Info - 10:08:03 AM] c:\users\luabud\appdata\local\continuum\anaconda3\envs\env\dlls [Info - 10:08:03 AM] c:\users\luabud\appdata\local\continuum\anaconda3\envs\env\lib [Info - 10:08:03 AM] c:\users\luabud\appdata\local\continuum\anaconda3\envs\env [Info - 10:08:03 AM] c:\users\luabud\appdata\roaming\python\python37\site-packages [Info - 10:08:03 AM] c:\users\luabud\appdata\local\continuum\anaconda3\envs\env\lib\site-packages [Info - 10:08:03 AM] Configuration search paths: [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\python37.zip [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\DLLs [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\lib [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env [Info - 10:08:03 AM] C:\Users\luabud\AppData\Roaming\Python\Python37\site-packages [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\lib\site-packages [Info - 10:08:03 AM] . [Info - 10:08:03 AM] C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env [Info - 10:08:05 AM] Microsoft Python Language Server version 0.2.30.0 [Info - 10:08:05 AM] Initializing for C:\Users\luabud\AppData\Local\Continuum\Anaconda3\envs\env\python.exe Traceback (most recent call last): File "C:\Users\luabud\.vscode-insiders\extensions\ms-python.python-2019.3.5917-rc\languageServer.0.2.30\scrape_module.py", line 1489, in <module> state.initial_import(sys.argv[2]) File "C:\Users\luabud\.vscode-insiders\extensions\ms-python.python-2019.3.5917-rc\languageServer.0.2.30\scrape_module.py", line 872, in initial_import mod = __import__(self.module_name) File "c:\users\luabud\appdata\local\continuum\anaconda3\envs\env\lib\site-packages\pandas\__init__.py", line 19, in <module> "Missing required dependencies {0}".format(missing_dependencies)) ImportError: Missing required dependencies ['numpy']

Worth mentioning numpy is installed in the environment
This error appeared 63 times more on the output window.
Python 3.7.2, extension version 2019.3.5917-rc, conda 4.6.8

@jakebailey
Copy link
Member

That message is likely the same as #817, the scraper has exceptions that are printed.

@MikhailArkhipov
Copy link

Python 3, 11 sec

image

@luabud
Copy link
Member

luabud commented Mar 25, 2019

I could reproduce it with a large requirements.txt file.
requirements.txt

@MikhailArkhipov
Copy link

MikhailArkhipov commented Mar 25, 2019

We don't actually read requirements and only open packages that are actually imported. Could you please set

"python.analysis.logLevel": "Trace",

Then copy contents of the output when analysis is done. Also, @luabud - what is your code.

@luabud
Copy link
Member

luabud commented Mar 25, 2019

I'm running the same code as @Anapo14, but weirdly it didn't take long this time (Analysis version 3104 of 4062 entries has been completed in 19406.989 ms), but the output is huge due to the exceptions being printed:
LSoutput.txt

@MikhailArkhipov
Copy link

@luabud - is it same environment or standalone Python

@luabud
Copy link
Member

luabud commented Mar 25, 2019

same conda environment
image

@Anapo14
Copy link
Contributor Author

Anapo14 commented Mar 25, 2019

Using the same Conda environment as before: Analysis version 3262 of 4204 entries has been completed in 218143.3832 ms which is about 3.6 minutes and is a lot faster than this morning's run. But I'll continue to monitor it.

I noticed that the time given in the trace is about 4 minutes less than the time I get when I set the timer on my phone, though (7.57 minutes). Is this by design? The analysis would freeze on a certain number of items being analyzed in the background before continuing on. Does the log take that"frozen" time into account?

log.txt

@jakebailey
Copy link
Member

Yes, the time isn't completely accurate as we do 2+ passes with varying degrees of analysis. We're looking into improving that to be more accurate, but we needed a way to see at least some number during testing with logging enabled.

@MikhailArkhipov
Copy link

There is fairly high overhead involved in actual output of messages. Time reported if for actual calculations, it does not take into account time spent in sending log messages to the client (VSC).

@jakebailey
Copy link
Member

The analysis time should be much improved in the latest release. Most of the time was spent working on PyQt5, which should be fixed as of #875. Closing this for now, and we'd appreciate it if you could retest (and potentially open more issues if we find more specific issues).

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

No branches or pull requests

4 participants