Skip to content
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

environment load sequence broken #7743

Open
excubo-jg opened this issue Oct 31, 2023 · 5 comments
Open

environment load sequence broken #7743

excubo-jg opened this issue Oct 31, 2023 · 5 comments
Assignees

Comments

@excubo-jg
Copy link

I experience this behavior with both the current version of vs 2022 and vs 2022 preview:

  • Opening a solution freezes the machine, eg blocks any interactions until (guessing this from the time needed) an initial Python analysis is done
    VS 2022 displays no env information but the preview version shows:
    image
    [This is an environment which is in the list of envs but I have never used it as I am on python 3.10 and newer]
  • Then the bar changes to display the environment associated with the solution
    image
    and a second Python analysis run is started, During which the system is responsive but displays error messages associated with the wrong env until the second run is finished.

This is quite annoying as larger projects take like a minute to load.

@StellaHuang95
Copy link
Contributor

Did you mean that pylance runs the analysis twice? Can you go to Tools -> Options -> Python -> Analysis, set the log level to Trace and share the logs? I can't repro it locally but perhaps my project is not large enough, the logs will give us some clues.

@excubo-jg
Copy link
Author

It seems to do so... This log was written right after updating to Version 17.8.0 Preview 6.0

vs_log.txt

@StellaHuang95
Copy link
Contributor

The python 3.9 is the global default and is expected to be added before other available environments are detected. See #7489.

The logs show the service started only once, and the same goes for the environment detection. What errors are you seeing associated with the other environment?

@excubo-jg
Copy link
Author

Many thanks for the link. So I did some more testing with several projects and it seems that my machine takes about 6-7 seconds to load vs and display the active py-file, then freezes - e.g. blocks all interactions - vs for 16 seconds, and then activates the respective conda env which takes additional time depending on the complexity of the project. Is this 16 second freeze really the expected behavior or is something (else?) off at my end?

In the pyproj files always only one relevant conda env is mentioned. Activating these envs from the conda command prompt happens instantaneously so I am not convinced that the condition "On project load, no environments are found" as mentioned in scenario 1 should apply. There seems to be no scenario for "Single conda environment (selected), no other environments" which is found at project load.

I had instances where at the end of the global env processing errors got reported which did not get removed until the conda env had been processed. I cannot repro this in the current set-up so let's ignore this for now.

@PaulDerynck
Copy link

This sounds similar to the problem I reported #7813. Initially I added Python support to my Visual Studio 2022 version 17.8.5. Then I installed Conda and then later I installed Python 3.12 from the MS Store. All of that was in response to VS not recognizing py scripts when I opened their folder from VS.

I can run a python script with either python environment if invoked from a BAT file. The problems I ran into started with trying to set up a python environment in VS. At some point I was successful in getting the py scripts in the folder to show up in VS, but I don't recall now how I did it. I ended up ensuring the Python Environments window is closed although my problem did reoccur once when I had one of the python scripts showing in the active window in VS.

If that happens again I'll add a log file.

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

No branches or pull requests

4 participants