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

Starting the kernel in the conda environment is very slow, much slower than starting it in python's native environment #22238

Closed
1 of 2 tasks
grantsimongrant opened this issue Oct 8, 2023 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@grantsimongrant
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

It will take a minute or two to start the kernel. Please speed up kernel startup in conda environment.

VS Code Version

1.83.0

Jupyter Extension Version

v2023.9.1102792234

Jupyter logs

No response

Coding Language and Runtime Version

python v3.12.0

Language Extension Version (if applicable)

python pylance

Anaconda Version (if applicable)

miniconda3

Running Jupyter locally or remotely?

Local

@grantsimongrant grantsimongrant added the bug Issue identified by VS Code Team member as probable bug label Oct 8, 2023
@DonJayamanne
Copy link

DonJayamanne commented Oct 8, 2023

Thanks for filing this issue, starting conda kernels is generally very slow due to the time taken to activate conda environments.

For instance as a user, activating conda environments in the terminal could be slow, opening a terminal and activating.
Then starting jupyter lab/notebook is fast as the environment is already activated
In vscode however, its designed to work with other python environments, not just one conda env, hence when starting a kernel in vscode, the conda environment needs to be activated (i.e. you would see the same delay in vscode that you would see outside, i.e. similar to opening a whole new terminal and launching jupyter).

That being said, I would like to still ensure this is the case and not anything else.
Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to verbose
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel.

@DonJayamanne DonJayamanne self-assigned this Oct 8, 2023
@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Oct 8, 2023
@DonJayamanne
Copy link

It will take a minute or two to start the kernel. Pl

Note, using packages like keras or others can further slow down activation of conda environments.
Specially on windows.

@DonJayamanne
Copy link

@grantsimongrant You can just uplodate the file into a github issue and that will work.
There'/s no need to upload to google drive or the like.

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files

Screenshot 2023-10-11 at 12 17 13

@grantsimongrant
Copy link
Author

It will take a minute or two to start the kernel. Pl

Note, using packages like keras or others can further slow down activation of conda environments. Specially on windows.

conda-environment-debug.txt

@DonJayamanne
Copy link

thanks for sharing the logs.

  • Unfortunately you haven't shared all of the logs,
  • Go into your command palette
    • Select Developer: Set Log Level -> Python -> Trace
  • Please can you re-load VS Code
  • Open the notebook, run the cell and replicate the issue
  • Then capture the Jupyter logs and share that here
  • Similarly, please share the Python logs as well.

Based on the logs some part of the code is timing out after 6s,
Since the Jupyter extension gets the python env information from Python extension, I'd like to get the logs from that extension as well.

@grantsimongrant
Copy link
Author

thanks for sharing the logs.

  • Unfortunately you haven't shared all of the logs,

  • Go into your command palette

    • Select Developer: Set Log Level -> Python -> Trace
  • Please can you re-load VS Code

  • Open the notebook, run the cell and replicate the issue

  • Then capture the Jupyter logs and share that here

  • Similarly, please share the Python logs as well.

Based on the logs some part of the code is timing out after 6s, Since the Jupyter extension gets the python env information from Python extension, I'd like to get the logs from that extension as well.

conda-environment-debug.txt

@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-jupyter Oct 17, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 17, 2023
@DonJayamanne
Copy link

@karrtikr based on the logs, activation of the conda env is failing

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Oct 17, 2023
@karrtikr
Copy link

@grantsimongrant Conda activation command seems to be failing for you. Can you run the following command outside VS Code in Command prompt and send the screenshot of the output?

conda run -p d:\Miniconda3\envs\pachong --no-capture-output python C:\Users\grant\.vscode\extensions\ms-python.python-2023.18.0\pythonFiles\get_output_via_markers.py C:/Users/grant/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/printEnvVariables.py

If it does not fail, try running the same inside VS Code by opening command prompt.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 26, 2023
Copy link

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants