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

Add support for activating env created using microvenv #21122

Closed
TylerLeonhardt opened this issue Apr 25, 2023 · 5 comments · Fixed by #21132
Closed

Add support for activating env created using microvenv #21122

TylerLeonhardt opened this issue Apr 25, 2023 · 5 comments · Fixed by #21132
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug

Comments

@TylerLeonhardt
Copy link
Member

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
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 25, 2023
@karthiknadig
Copy link
Member

@karrtikr Not sure why the PATH to the new venv is not being selected.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Apr 25, 2023
@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Apr 25, 2023
@karrtikr
Copy link

@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?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Apr 25, 2023
@karthiknadig
Copy link
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

@karrtikr
Copy link

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

@karrtikr karrtikr removed their assignment Apr 25, 2023
@karrtikr karrtikr added feature-request Request for new features or functionality area-environments Features relating to handling interpreter environments needs PR Ready to be worked on and removed info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team labels Apr 25, 2023
@karrtikr karrtikr 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 Apr 25, 2023
@karthiknadig
Copy link
Member

@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.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Apr 26, 2023
eleanorjboyd pushed a commit to eleanorjboyd/vscode-python that referenced this issue Apr 28, 2023
eleanorjboyd pushed a commit to eleanorjboyd/vscode-python that referenced this issue May 12, 2023
eleanorjboyd pushed a commit to eleanorjboyd/vscode-python that referenced this issue May 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2023
@eleanorjboyd eleanorjboyd removed the needs PR Ready to be worked on label Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants