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

python environment is not activated in the new terminal #22141

Closed
sgstq opened this issue Oct 3, 2023 · 11 comments
Closed

python environment is not activated in the new terminal #22141

sgstq opened this issue Oct 3, 2023 · 11 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@sgstq
Copy link

sgstq commented Oct 3, 2023

Type: Bug

Behaviour

Expected vs. Actual

Upon creating the new terminal current environment has not being activated.
This works fine on v2023.16.0 though.
The behavior of pre-release version:

Got notification:

The Python extension automatically activates all terminals
using the selected environment, even when the name of the
environment, i.e "(test)" is not present in the terminal prompt.

output:

2023-10-03 14:52:45.144 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 14:52:45.144 [info] shell: zsh
2023-10-03 14:52:45.171 [info] Starting Pylance language server.
2023-10-03 14:52:45.184 [info] > conda info --json
2023-10-03 14:52:46.084 [info] > /bin/python3 ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 14:52:46.084 [info] shell: zsh

Here is and output of working vertion:

2023-10-03 14:39:47.425 [info] Python interpreter path: ~/miniconda3/envs/test/bin/python
2023-10-03 14:39:49.401 [info] Starting Pylance language server.
2023-10-03 14:39:49.414 [info] > conda info --json
2023-10-03 14:49:58.234 [info] > conda info --json
2023-10-03 14:49:59.986 [info] Send text to terminal: conda activate test

Steps to reproduce:

  1. set active environment
  2. Python: create terminal

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.5
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2023-10-03 14:52:43.354 [info] Experiment 'python.createEnvironment.trigger' is active
2023-10-03 14:52:43.354 [info] Experiment 'pythonaa' is active
2023-10-03 14:52:43.354 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-10-03 14:52:43.354 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-10-03 14:52:43.354 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-10-03 14:52:43.354 [info] Experiment 'pythonTestAdapter' is active
2023-10-03 14:52:43.354 [info] Test server listening.
2023-10-03 14:52:43.354 [info] Python interpreter path: ~/miniconda3/envs/test/bin/python
2023-10-03 14:52:43.396 [info] > conda info --json
2023-10-03 14:52:43.396 [info] shell: zsh
2023-10-03 14:52:45.144 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 14:52:45.144 [info] shell: zsh
2023-10-03 14:52:45.171 [info] Starting Pylance language server.
2023-10-03 14:52:45.184 [info] > conda info --json
2023-10-03 14:52:46.084 [info] > /bin/python3 ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 14:52:46.084 [info] shell: zsh

User Settings


languageServer: "Pylance"

Extension version: 2023.19.12761007
VS Code version: Code - Insiders 1.83.0-insider (4268e464763087044d0c1b5bdd37ebbe683cadfa, 2023-09-29T20:42:50.630Z)
OS version: Windows_NT x64 10.0.23555
Modes:
Remote OS version: Linux x64 5.15.123.1-microsoft-standard-WSL2
Remote OS version: Linux x64 5.15.123.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
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
Load (avg) undefined
Memory (System) 39.87GB (23.43GB free)
Process Argv --folder-uri=vscode-remote://wsl+Ubuntu-22.04/home/sg/_code/substrata/user-service --remote=wsl+Ubuntu-22.04 --crash-reporter-id ee6ae925-a0ca-419b-86d9-e2609790f1c6
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-22.04
OS Linux x64 5.15.123.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
Memory (System) 19.47GB (17.75GB free)
VM 0%
Item Value
Remote WSL: Ubuntu-22.04
OS Linux x64 5.15.123.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)
Memory (System) 19.47GB (17.75GB free)
VM 0%
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30404738
py29gd2263:30784851
vscaat:30438846
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
a9j8j154:30646983
showlangstatbar:30737417
7ij38806:30687742
pythonfmttext:30716741
fixshowwlkth:30771523
showindicator:30805243
pythongtdpath:30726887
i26e3531:30792625
welcomedialog:30812478
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
copilotsettingt:30808721
asynctok:30821568
dsvsc013:30777762
dsvsc014:30777825
diffeditorv2:30786206
pythonmypywwcf:30841057
pythonmpsinfo:30842935
dsvsc015:30821418
pythontestfixtcf:30826907
pythonfb280951:30830809
pythonregdiag:30842812
pythonmypyd1cf:30850306
pythoncet0cf:30848248

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 3, 2023
@karrtikr
Copy link

karrtikr commented Oct 3, 2023

How're you inferring whether the environment is activated or not, is something not working as expected in terminal?

Note as the notification says, terminals are expected to be activated even when you don't see the "(test)" indicator in your terminal. To verify, you can run:

python -c"import sys;print(sys.executable)

command and it should ideally contain path to test environment.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 3, 2023
@sgstq
Copy link
Author

sgstq commented Oct 3, 2023

I see it in my shell and yes, I also checked with the sys
here is what I have with the pre-release:
image

this one with v2023.16.0
image

note conda activate test passed by extension as text to shell automatically

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

karrtikr commented Oct 3, 2023

Thanks, we would need a couple of details to identify the issue:

  • Can you send your User/Remote settings? We need shell integration to be enabled.
  • Hover over the zsh - test terminal name and click "Show environment contributions", we would like the contents under that file.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 3, 2023
@sgstq
Copy link
Author

sgstq commented Oct 3, 2023

here is the content of environment changes:

# Terminal Environment Changes

## Extension: vscode.git

Enables the following features: git auth provider

- `GIT_ASKPASS=/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/extensions/git/dist/askpass.sh`
- `VSCODE_GIT_ASKPASS_NODE=/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/node`
- `VSCODE_GIT_ASKPASS_EXTRA_ARGS=`
- `VSCODE_GIT_ASKPASS_MAIN=/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/extensions/git/dist/askpass-main.js`
- `VSCODE_GIT_IPC_HANDLE=/run/user/1000/vscode-git-be4bf78cd4.sock`

## Extension: ms-python.python

Activated environment for `~/miniconda3/envs/test/bin/python`

- `CONDA_ROOT=/home/sg/miniconda3`
- `CONDA_PREFIX=/home/sg/miniconda3/envs/test`
- `CONDA_PROMPT_MODIFIER=(test) `
- `CONDA_SHLVL=2`
- `CONDA_DEFAULT_ENV=test`
- `PATH=/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/bin/remote-cli:/home/sg/miniconda3/envs/test/bin:/home/sg/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/libnvvp:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/PowerShell/7-preview/preview:/mnt/c/Program Files/WireGuard:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2023.2.2:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Users/sgstq/miniconda3:/mnt/c/Users/sgstq/miniconda3/Library/mingw-w64/bin:/mnt/c/Users/sgstq/miniconda3/Library/usr/bin:/mnt/c/Users/sgstq/miniconda3/Library/bin:/mnt/c/Users/sgstq/miniconda3/Scripts:/mnt/c/Users/sgstq/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/sgstq/AppData/Local/Programs/oh-my-posh/bin:/mnt/c/Users/sgstq/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/home/sg/.yarn/bin:${env:PATH}`
- `CONDA_PREFIX_1=/home/sg/miniconda3`
- `PS1=(test) ${env:PS1}`

here are the settings:

{
    "window.zoomLevel": 2,
    "yaml.schemas": {
        "file:///home/sg/.vscode-server-insiders/extensions/atlassian.atlascode-3.0.6/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
    },
    "redhat.telemetry.enabled": false,
    "editor.inlineSuggest.enabled": true,
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.formatOnType": true,
    },
    "files.exclude": {
        "**/.git": false
    },
    "python.analysis.autoImportCompletions": true,
    "window.newWindowDimensions": "maximized",
    "python.terminal.activateEnvInCurrentTerminal": true,
    "python.linting.mypyEnabled": true,
    "python.analysis.typeCheckingMode": "strict",
    "files.trimTrailingWhitespace": true,
    "files.insertFinalNewline": true,
    "editor.fontFamily": "'CaskaydiaCove NF', 'CaskaydiaCove Nerd Font', 'Cascadia Code', Consolas, 'Courier New', monospace",
}

added "terminal.integrated.shellIntegration.enabled": true - did not help

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

karrtikr commented Oct 3, 2023

Can you print PATH, CONDA_PREFIX and some other variables in your terminal and send the output? Want to see how it differs.

echo $PATH

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

karrtikr commented Oct 3, 2023

Lastly, some debug logs would be helpful:

  • Run Developer: Set log level command
  • Select Python -> Select Trace
  • Run Developer: Reload Window command
  • Provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@sgstq
Copy link
Author

sgstq commented Oct 3, 2023

╰─ echo $PATH                                                                                   ─╯
/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/bin/remote-cli:/home/sg/miniconda3/bin:/home/sg/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/libnvvp:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/PowerShell/7-preview/preview:/mnt/c/Program Files/WireGuard:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2023.2.2:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Users/me/miniconda3:/mnt/c/Users/me/miniconda3/Library/mingw-w64/bin:/mnt/c/Users/me/miniconda3/Library/usr/bin:/mnt/c/Users/me/miniconda3/Library/bin:/mnt/c/Users/me/miniconda3/Scripts:/mnt/c/Users/me/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/me/AppData/Local/Programs/oh-my-posh/bin:/mnt/c/Users/me/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/home/sg/.yarn/bin:/home/sg/.vscode-server-insiders/bin/e7e037083ff4455cf320e344325dacb480062c3c/bin/remote-cli:/home/sg/miniconda3/bin:/home/sg/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2/libnvvp:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/PowerShell/7-preview/preview:/mnt/c/Program Files/WireGuard:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/GnuPG/bin:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2023.2.2:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0:/mnt/c/WINDOWS/System32/OpenSSH:/mnt/c/Users/me/miniconda3:/mnt/c/Users/me/miniconda3/Library/mingw-w64/bin:/mnt/c/Users/me/miniconda3/Library/usr/bin:/mnt/c/Users/me/miniconda3/Library/bin:/mnt/c/Users/me/miniconda3/Scripts:/mnt/c/Users/me/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/me/AppData/Local/Programs/oh-my-posh/bin:/mnt/c/Users/me/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/home/sg/.yarn/bin
╭─░▒▓      ~/_code/etc/test                                ✔  base    09:05:49 PM   ▓▒░─╮
╰─ echo $CONDA_PREFIX                                                                           ─╯
/home/sg/miniconda3

trace:

2023-10-03 21:14:53.678 [info] Experiment 'python.createEnvironment.trigger' is active
2023-10-03 21:14:53.678 [info] Experiment 'pythonaa' is active
2023-10-03 21:14:53.678 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-10-03 21:14:53.678 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-10-03 21:14:53.678 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-10-03 21:14:53.678 [info] Experiment 'pythonTestAdapter' is active
2023-10-03 21:14:54.371 [info] Test server listening.
2023-10-03 21:14:54.372 [info] Python interpreter path: ~/miniconda3/envs/test/bin/python
2023-10-03 21:14:55.078 [info] > conda info --json
2023-10-03 21:14:55.078 [info] shell: zsh
2023-10-03 21:14:57.310 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 21:14:57.310 [info] shell: zsh
2023-10-03 21:14:57.425 [info] > conda info --json
2023-10-03 21:14:58.399 [info] > /bin/python3 ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 21:14:58.399 [info] shell: zsh
2023-10-03 21:14:58.694 [info] Starting Pylance language server.
2023-10-03 21:14:59.437 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/linter.py -m mypy --follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty ./test.py
2023-10-03 21:14:59.437 [info] cwd: .
2023-10-03 21:15:00.108 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py -c "import mypy"
2023-10-03 21:15:00.580 [error] There was an error in running the linter mypy n [Error]: Module 'mypy' not installed.
    at s.execForLinter (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:234513)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at a.run (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:541293)
    at a.runLinter (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:554423)
2023-10-03 21:15:00.580 [error] Support for "mypy" is moved to ms-python.mypy-type-checker extension.
2023-10-03 21:15:00.580 [error] Please install the extension from: https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker
2023-10-03 21:15:00.580 [error] If the error is due to missing mypy, please install mypy using pip manually.
2023-10-03 21:15:00.580 [error] Learn more here: https://aka.ms/AAlgvkb
2023-10-03 21:15:00.580 [info] Linting with mypy failed.
2023-10-03 21:15:00.580 [info] Error: Module 'mypy' not installed.

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

karrtikr commented Oct 3, 2023

Thank you. One last thing I would like if you can send me this screenshot:

image

after hovering over the terminal.

Btw running the following command should make your issue go away:

conda config --set auto_activate_base false

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 3, 2023
@sgstq
Copy link
Author

sgstq commented Oct 3, 2023

found that after reload window log level back to info so this trace is before reload

2023-10-03 21:22:01.651 [info] Experiment 'python.createEnvironment.trigger' is active
2023-10-03 21:22:01.651 [info] Experiment 'pythonaa' is active
2023-10-03 21:22:01.651 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-10-03 21:22:01.651 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-10-03 21:22:01.651 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2023-10-03 21:22:01.651 [info] Experiment 'pythonTestAdapter' is active
2023-10-03 21:22:01.651 [info] Test server listening.
2023-10-03 21:22:01.651 [info] Python interpreter path: ~/miniconda3/envs/test/bin/python
2023-10-03 21:22:02.115 [info] > conda info --json
2023-10-03 21:22:02.115 [info] shell: zsh
2023-10-03 21:22:04.458 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 21:22:04.459 [info] shell: zsh
2023-10-03 21:22:04.691 [info] > conda info --json
2023-10-03 21:22:05.694 [info] > /bin/python3 ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/printEnvVariables.py
2023-10-03 21:22:05.695 [info] shell: zsh
2023-10-03 21:22:06.748 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/linter.py -m mypy --follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty ./test.py
2023-10-03 21:22:06.748 [info] cwd: .
2023-10-03 21:22:06.778 [info] Starting Pylance language server.
2023-10-03 21:22:07.691 [info] > conda run -n test --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/pythonFiles/get_output_via_markers.py -c "import mypy"
2023-10-03 21:22:08.386 [error] There was an error in running the linter mypy n [Error]: Module 'mypy' not installed.
    at s.execForLinter (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:234513)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at a.run (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:541293)
    at a.runLinter (/home/sg/.vscode-server-insiders/extensions/ms-python.python-2023.19.12761007/out/client/extension.js:2:554423)
2023-10-03 21:22:08.386 [error] Support for "mypy" is moved to ms-python.mypy-type-checker extension.
2023-10-03 21:22:08.386 [error] Please install the extension from: https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker
2023-10-03 21:22:08.386 [error] If the error is due to missing mypy, please install mypy using pip manually.
2023-10-03 21:22:08.386 [error] Learn more here: https://aka.ms/AAlgvkb
2023-10-03 21:22:08.386 [info] Linting with mypy failed.
2023-10-03 21:22:08.386 [info] Error: Module 'mypy' not installed.
2023-10-03 21:22:38.957 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:22:50.665 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:22:50.665 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:22:50.665 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-03 21:22:50.668 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:22:50.668 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:22:50.668 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:22:50.668 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:22:50.669 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:22:50.669 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:22:50.669 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:22:50.706 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-03 21:27:02.703 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:27:02.703 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:27:02.703 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:27:02.707 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:27:02.708 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:27:02.708 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:27:02.708 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:27:02.712 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/home/sg/miniconda3/envs/test/bin/python"-Arg-Separator-{"uri":{"$mid":1,"fsPath":"/home/sg/_code/etc/test","external":"file:///home/sg/_code/etc/test","path":"/home/sg/_code/etc/test","scheme":"file"},"name":"test","index":0}
2023-10-03 21:27:02.734 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:27:02.853 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:32:02.635 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:32:02.638 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:32:02.639 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:32:02.668 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:37:02.609 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:37:02.615 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:37:02.615 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:37:02.654 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:42:02.559 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:42:02.561 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:42:02.562 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:42:02.610 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:42:02.662 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:42:03.072 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:42:03.077 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:42:03.078 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:42:03.119 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:47:02.602 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:47:02.606 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:47:02.606 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:47:02.648 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:52:02.597 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:52:02.599 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:52:02.599 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:52:02.643 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:57:02.619 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:57:02.624 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:57:02.624 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:57:02.660 [debug] Clearing context for python dependencies not installed: /home/sg/_code/etc/test/test.py
2023-10-03 21:59:50.043 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-03 21:59:50.044 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-03 21:59:50.045 [debug] Found cached env for /home/sg/miniconda3/envs/test/bin/python
2023-10-03 21:59:50.045 [debug] Resolved /home/sg/miniconda3/envs/test/bin/python from cache: {"name":"test","location":"/home/sg/miniconda3/envs/test","kind":"virt-conda","executable":{"filename":"/home/sg/miniconda3/envs/test/bin/python","sysPrefix":"/home/sg/miniconda3/envs/test","ctime":1696335876924,"mtime":1696335876924},"display":"Python 3.11.5 ('test')","version":{"major":3,"minor":11,"micro":5,"release":{"level":"final","serial":0},"sysVersion":"3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/home/sg/miniconda3/envs/test/bin/python","detailedDisplayName":"Python 3.11.5 ('test': conda)"}
2023-10-03 21:59:50.046 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/home/sg/miniconda3/envs/test/bin/python"-Arg-Separator-undefined

here is a screenshot:
image

yes conda config --set auto_activate_base false solved the issue, thanks
but I would like to have an active env at shell startup outside vscode. is there any other way to fix it?

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

karrtikr commented Oct 3, 2023

It's probably because you fall into the limitations of automatic shell integration using SSH: https://code.visualstudio.com/docs/terminal/shell-integration#_automatic-script-injection

Can you try manual installation for zsh mentioned in https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation?

Before trying this workaround, make sure to disable #22141 (comment):

conda config --set auto_activate_base true

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 3, 2023
@sgstq
Copy link
Author

sgstq commented Oct 4, 2023

The manual installation of shell integration helped, thank you ❤️

@sgstq sgstq closed this as completed Oct 4, 2023
@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants