-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use new vsc API to activate terminal without running any commands in terminal #11039
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hello, I was wondering if this would help with #5559 (specifically for conda environments)? |
hey @iutlu! it is something we've been actively discussing in the team, but we need to do some investigations first |
The API moved to |
Will this also set the |
@yumasheta thanks for bringing this up! We haven't fully spec'ed this yet (I just updated the label here on the issue to reflect it 😊), so that's something to be considered. |
For microsoft#20822 microsoft#11039 Replacing as-is has its problems, for eg. pyenv asks their users to manipulate `PATH` in their init script: https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv, which we could end up replacing. ![image](https://github.com/microsoft/vscode-python/assets/13199757/cc904f76-8d42-47e1-a6c8-6cfff6543db8) Particularly for pyenv, it mean users not being able to find pyenv: ![image](https://github.com/microsoft/vscode-python/assets/13199757/26100328-c227-435b-a4f2-ec168099f4c1) Prepending solves it for cases where initial PATH value is suffix of the final value: ![image](https://github.com/microsoft/vscode-python/assets/13199757/a95e4ffd-68dc-4e73-905e-504b3051324f) But, in other cases, this means that we end up with the whole `PATH` thrice. This is because it prepends it twice: - Once in shell integration script - Once when creating a process So the final value could be: ``` PATH=<activated_full_path><activated_full_path><original_path> ``` where `<activated_full_path>` refers to value of `PATH` environment variable post activation. eg. ![image](https://github.com/microsoft/vscode-python/assets/13199757/7e771f62-eb53-49be-b261-d259096008f3)
This feature is great however, I would like to deactivate the self-activated venv sometimes to switch to another venv, sometimes. Is there any workaround to fix deactivate the venv? (mix-3.10) user@Latitude:~/Desktop$ deactivate
deactivate: command not found
(mix-3.10) user@Latitude:~/Desktop$ The quick workaround for me now is by adding this into the settings.json but I feel there must be a better solution "python.terminal.activateEnvInCurrentTerminal": false,
"python.terminal.activateEnvironment": true,
"python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"], |
Hi @jwtanx thanks for the feedback, please try out the workaround mentioned in #22037 (comment) for this issue. |
Thanks! |
I'm a regular vscode-python user and the only reason I'm here is because I couldn't figure out how to deactivate the auto-activated environment. It's really nice to see the dev team working on improving the extension and I'm very welcoming of the features added in the past few releases, but please try not to break existing workflows. |
Thanks for your continued supported and letting us know about this. We want to reassure that we are committed to preserving existing workflows, but sometimes changes are necessary for improvements. In this case, the deactivate command's limitation is due to the new approach, and we've documented a workaround in a comment made just above #11039 (comment). |
@nikhilweee do note that we are trying to fix existing workflows (sending the |
My existing flow was broken by this change, it would be nice if there was a setting to re-enable the explicit Because of the way my server environment is setup I need to edit on a different machine than I launch my code on. To make this simpler I made a terminal like this:
this worked fine with the explicit |
@Queuecumber is there a reason you're not using Remote - SSH? |
I am -- I have to "remote - ssh" to the code editing server and then ssh to a code submission server to actually run it. And to clarify a little more, I am not allowed to directly connect the vscode server to the code submission server, it has to be a bare ssh session. |
Please upvote #22289 if you would like us to add such a setting. |
@Tyriar From my recollection either the bashrc or bashprofile is not loaded by the terminals when using remote ssh. |
@Queuecumber unless I'm misunderstanding, it sounds like it was working before just by coincidence because the same file structure exists on your "code submission server"? In that case I would expect it not to be a supported scenario for the extension/feature. |
Not coincidence: design. It's the same filesystem (network filesystem) on both machines, otherwise I couldn't easily develop on one machine and submit code on the other. We do this because the vscode server can use enough resources to slow down the machine and we don't want it interfering with code submissions. There are two ways to fix it: ship the environment variables over ssh (this should be possible) or just have an option to use the old source based method (should be easy). If you'd like more details on our setup and its motivation I'm happy to start a discussion though NVIDIA internal channels. |
Contribute to terminal environments
This new API allows extensions to change environment variables when the terminal is starting up.
python
in terminal will user correct environment even when terminal is already open.env
variables into terminal without activation of environmentThe text was updated successfully, but these errors were encountered: