vscode-python: Terminal no longer activates virtual environment for csh/tcsh shell
Type: Bug
Behaviour
Expected vs. Actual
At work, we’ve been using VS Code for a while with python virtual environments. The previous behavior was that when you opened a terminal (while a virtual environment was activated) it would run the activate script in that virtual environment. For example for me, usually venv/bin/activate.csh
. This script has become an important part of our workflow, since it allows us to customize the environment python will run in, register aliases, etc.
Ever since a few months ago, VS code no longer runs this activation script. It says “Python virtual environment was successfully activated, even though “(venv)” indicator may not be present in the terminal prompt.”, Which seems to indicate that it is triggering the virtual environment, but none of the environment is actually being configured in the terminal. All environment variables and aliases are absent.
Steps to reproduce:
- Create a python virtual environment.
- Modify the activate script
- select the virtual environment from thepython version dropdown in VS Code
- Open a terminal
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.4
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServer
setting: Pylance
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
User Settings
languageServer: "Pylance"
testing
• pytestEnabled: true
Extension version: 2023.22.1 VS Code version: Code 1.85.2 (Universal) (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z) OS version: Darwin arm64 22.6.0 Modes:
System Info
Item | Value |
---|---|
CPUs | Apple M1 Max (10 x 24) |
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) | 3, 2, 2 |
Memory (System) | 32.00GB (0.08GB free) |
Process Argv | –crash-reporter-id 00815bc4-2696-4c23-866e-19b398c1bc9b |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30951796
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
dsvsc019bcf:30953938
3ef8e399:30949928
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 4
- Comments: 45
Commits related to this issue
- Fix venv activation for cshell (#22852) Closes https://github.com/microsoft/vscode-python/issues/22822 Use current shell to figure out whether shell integration is working, even when using fallba... — committed to microsoft/vscode-python by deleted user 5 months ago
- Fix venv activation for cshell (#22852) Closes https://github.com/microsoft/vscode-python/issues/22822 Use current shell to figure out whether shell integration is working, even when using fallba... — committed to microsoft/vscode-python by deleted user 5 months ago
Actually this problem applies to all shells (not just csh), bash and zsh work with
which python
but do not actually contain the environment variables from the activate scripts like they used to.It looks like the plugin isn’t actually loading the environment, it’s only modifying PATH?
@rhizodigital I’ve created a new issue on your behalf, as we’re dealing with different causes here.
im using zsh and have same issue
Interesting! Switching my default terminal to bash works fine! tcsh and csh both don’t work, but bash works.
I have same problems and I use vscode on windows 10