Skip to content

Add support for activating env created using microvenv #21122

Closed

Description

@TylerLeonhardt

Testing #21100

After following the steps in #21100 I tried running python in a new terminal inside of VS Code and got:\

codeuser@DESKTOP-HOME:~/test$ python -m pip install pytest
Command 'python' not found, did you mean:
  command 'python3' from deb python3
  command 'python' from deb python-is-python3

Not much in the logs department:

2023-04-25 12:23:40.485 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-04-25 12:23:40.485 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-04-25 12:23:40.538 [info] Test server listening.
2023-04-25 12:23:40.547 [info] Python interpreter path: ./.venv/bin/python
2023-04-25 12:23:41.702 [info] Starting Pylance language server.

This was in WSL using WSLg so here's what the PATH looks like:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Python310/Scripts/:/mnt/c/Python310/:/mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/PowerShell/7-preview/preview:/mnt/c/Program Files (x86)/Yarn/bin/:/mnt/c/Program Files/OpenSSH-Win64:/mnt/c/Users/Tyler/Downloads/Storage_Download:/mnt/c/images/kahuku/14.26.1/Storage_Download:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Users/tyleonha/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/tyleonha/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/snap/bin

Activity

  1. karthiknadig commented on Apr 25, 2023

    @karthiknadig
    Member

    Kartik Raj (@karrtikr) Not sure why the PATH to the new venv is not being selected.

  2. karrtikr commented on Apr 25, 2023

    @karrtikr

    Karthik Nadig (@karthiknadig),

    • How are we making sure the environment is activated in terminal?
    • And what is the path of environment that is used to create the env?
  3. karthiknadig commented on Apr 25, 2023

    @karthiknadig
    Member

    The environment after certation is selected. It is no different than a venv. This is microvenv, there are no activate scripts. All that is needed is that python points to .venv/bin/python

  4. karrtikr commented on Apr 25, 2023

    @karrtikr

    Well, currently activation requires activation scripts. If there're no scripts no env is activated.

  5. removed their assignment
    on Apr 25, 2023
  6. added
    feature-requestRequest for new features or functionality
    area-environmentsFeatures relating to handling interpreter environments
    needs PRReady to be worked on
    and removed
    info-neededIssue requires more information from poster
    triage-neededNeeds assignment to the proper sub-team
    on Apr 25, 2023
  7. changed the title [-] new python path isn't being added to the PATH properly after creating the environment[/-] [+]Add support for activating env created using microvenv[/+] on Apr 25, 2023
  8. karthiknadig commented on Apr 25, 2023

    @karthiknadig
    Member

    Kartik Raj (@karrtikr) microvenv does not use activation to work. All it needs is to be on PATH. When we detect a microvenv (i.e, no activation scripts, but has pyenv.cfg), then all that is needed is to add the bin path (i.e, .venv/bin) to PATH.

  9. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    feature-requestRequest for new features or functionality
    on Apr 26, 2023
  10. locked as resolved and limited conversation to collaborators on May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions