Skip to content

Environment discovery is taking a VERY long time #1587

Closed

Description

@rchiodo

I opened the code at https://github.com/pytorch/pytorch.git (after cloning it) and got this output in the enviroments extension:

2026-06-16 10:53:57.678 [warning] [Pipenv] Environment discovery took 199.2s (found 0 environments). If this is causing problems, please report it: https://github.com/microsoft/vscode-python-environments/issues/new
2026-06-16 10:54:52.264 [info] Refreshing poetry environments
2026-06-16 10:54:52.272 [warning] [Poetry] Environment discovery took 253.8s (found 0 environments). If this is causing problems, please report it: https://github.com/microsoft/vscode-python-environments/issues/new

I have 4 or 5 pythons installed on this machine and a single venv in the pytorch folder.

Activity

  1. rchiodo commented on Jun 18, 2026

    @rchiodo
    ContributorAuthor

    I tried again. Here's the full logs:

    python-environments.log

  2. StellaHuang95 commented on Jun 19, 2026

    @StellaHuang95
    Contributor

    Did some investigation and I think the root cause is that handleHardRefresh doesn't dedup.

    One refreshEnvironments(undefined) call → fans out to N parallel manager.refresh(undefined) calls → each independently asks PET to do a full scan with the same key.

    Concretely, the chain at startup:

    Image

    So each manager only cares about its own env type (poetry filters PET output for kind === 'poetry', pyenv filters for 'pyenv', etc.), but the PET scan they each trigger is an identical full discovery of everything on the system. That's why the same Discovered env: <path> lines appear 4-5 times in the log.

  3. added a commit that references this issue on Jun 23, 2026
    036e883
  4. locked as resolved and limited conversation to collaborators on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions