-
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
Terminal doesn't activate selected pyenv virtualenv environment #22217
Comments
Python debug logs with trace level: Debug logs
|
Thanks for sending all the essential information needed to diagnose the issue. Can you try adding the following to User settings: "terminal.integrated.inheritEnv": false, If that doesn't solve it:
|
Adding VSCode is running on my local machine (MacBook M1). The behavior of not activating the virtualenv happens for some repos, but not for others. user settings: {
"workbench.colorTheme": "Default Dark Modern",
"terminal.integrated.fontFamily": "MesloLGS NF",
"git.confirmSync": false,
"gitlens.hovers.currentLine.over": "line",
"security.workspace.trust.untrustedFiles": "open",
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"],
"terminal.integrated.defaultProfile.osx": "zsh",
"editor.inlineSuggest.enabled": true,
"jupyter.jupyterCommandLineArguments": [
"--port=9990"
],
"git.branchProtection": [
"master"
],
"editor.largeFileOptimizations": false,
"git.suggestSmartCommit": false,
"python.analysis.extraPaths": [
"../pms-dashboard",
"../oi_integrations_constants",
"../pythonscripts",
"../integration_scripts"
],
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
}
},
"flake8.path": [
"/Users/kasperzutterman/.pyenv/versions/python-linting/bin/flake8"
],
"flake8.args": [
"--append-config",
"/Users/kasperzutterman/repositories/otainsight/sharedimages/pythoncodequality/pytest.ini",
"--append-config",
"${workspaceFolder}/pytest.ini"
],
"autopep8.args": [
"-j",
"1",
"--ignore-local-config",
"--global-config",
"/Users/kasperzutterman/repositories/otainsight/sharedimages/pythoncodequality/pyproject.toml"
],
"isort.args": [
"--settings-file",
"${workspaceFolder}/pytest.ini",
],
"python.diagnostics.sourceMapsEnabled": true,
"window.restoreFullscreen": true,
"window.newWindowDimensions": "maximized",
"github.copilot.enable": {
"*": true,
"yaml": false,
"plaintext": false,
"markdown": true
},
"redhat.telemetry.enabled": false,
"settingsSync.ignoredExtensions": [
"ms-vscode.vscode-js-profile-flame",
"pkief.material-icon-theme",
"davidnussio.vscode-jq-playground",
"serayuzgur.crates",
"ms-vscode.powershell"
],
"git.autofetch": true,
"window.zoomLevel": -1,
"editor.unicodeHighlight.invisibleCharacters": false,
"terminal.integrated.env.osx": {
"MallocNanoZone": "1",
//"MallocNanoZone": "0",
},
"gitlens.gitCommands.skipConfirmations": [
"fetch:command",
"switch:command"
],
"editor.multiCursorModifier": "ctrlCmd",
"workbench.editor.empty.hint": "hidden",
"terminal.integrated.inheritEnv": false,
} |
Its seems that automatic shell integration isn't working for you. Try installing it manually https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation for zsh. |
@karrtikr adding your suggestion seems to have fixed the PATH, but the issue with pyenv activation still persists for this one repo. # Terminal Environment Changes
## Extension: googlecloudtools.cloudcode
- `PATH=/Users/kasperzutterman/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin:${env:PATH}`
## Extension: vscode.git
Enables the following features: git auth provider
- `GIT_ASKPASS=/System/Volumes/Data/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh`
- `VSCODE_GIT_ASKPASS_NODE=/System/Volumes/Data/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)`
- `VSCODE_GIT_ASKPASS_EXTRA_ARGS=--ms-enable-electron-run-as-node`
- `VSCODE_GIT_ASKPASS_MAIN=/System/Volumes/Data/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js`
- `VSCODE_GIT_IPC_HANDLE=/var/folders/sm/jr7dlmh50kl24fxmw8sws_cr0000gp/T/vscode-git-e7c65c7a5e.sock`
## Extension: ms-python.python
Activated environment for `~/.pyenv/versions/3.10.12/envs/pythonscripts/bin/python`
- `PATH=/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts/bin:${env:PATH}`
- `VIRTUAL_ENV=/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts`
- `PS1=(pythonscripts) ${env:PS1}`
- `VIRTUAL_ENV_PROMPT=(pythonscripts) ` |
Can you check the value of PATH in terminal by using echo? |
Also, can you please elaborate on how youre checking whether the environment is correctly activated, is it by printing sys.executable? |
I guess the issue is fixed, but powerlevel10K isn't picking up the correct env. echo $PATH
/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts/bin:/Users/kasperzutterman/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/Users/kasperzutterman/.pyenv/shims:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/Users/kasperzutterman/.pyenv/shims:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/kasperzutterman/google-cloud-sdk/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts/bin:/Users/kasperzutterman/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts/bin:/Users/kasperzutterman/Library/Application Support/cloud-code/installer/google-cloud-sdk/bin:/Users/kasperzutterman/google-cloud-sdk/bin:/opt/homebrew/opt/openssl@3/bin:/opt/homebrew/bin:/opt/homebrew/sbin python -c"import sys;print(sys.executable)" ok | 3.10.6 py | 14:56:44
/Users/kasperzutterman/.pyenv/versions/3.10.12/envs/pythonscripts/bin/python |
Sorry I'm not sure what you mean by that? |
Let us know if there's anything more the extension can do to help mitigate the situation, closing this for now. |
Type: Bug
Behaviour
Expected vs. Actual
Steps to reproduce:
python -c"import sys;print(sys.executable)"
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.19.12860613
VS Code version: Code 1.83.1 (f1b07bd25dfad64b0167beb15359ae573aecd2cc, 2023-10-10T23:57:32.750Z)
OS version: Darwin arm64 22.6.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: