You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I switched virtual environment tools for a project from venv to conda but extensions which used python such as ruff continued to reference the old environment. After hours of digging I found a envVar.txt in the extensions directory which contained environment variables referencing the old and now deleted venv directory. This was resulting in virtual environment configuration for ruff to fail due to the removed venv directory.
Steps to reproduce:
Install Python and Ruff extensions and conda
Create a python workspace and configure ruff (see config below)
Setup a venv in the shell for the project under VS Code python -m venv venv
Activate the environment source venv/bin/activate
Change Default Env Manager manager for the workspace to ms-python.python:conda
The fix was to remove the old deactivate directory, but this was very hard to find as it wasn't associated with workspace in any way.
Diagnostic data
No relavent information from python, error was in the Ruff log, failing to configure python extension as it was trying to run the activate from the old environment.
Extension version: 2025.2.0
VS Code version: Code 1.98.0 (Universal) (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z)
OS version: Darwin arm64 24.3.0
Modes:
Remote OS version: Linux arm64 6.10.14-linuxkit
Python version (& distribution if applicable, e.g. Anaconda): 3.12.7
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
Value of the python.languageServer setting: Default
Type: Bug
Behaviour
I switched virtual environment tools for a project from
venv
toconda
but extensions which used python such as ruff continued to reference the old environment. After hours of digging I found aenvVar.txt
in the extensions directory which contained environment variables referencing the old and now deletedvenv
directory. This was resulting in virtual environment configuration forruff
to fail due to the removedvenv
directory.Steps to reproduce:
python -m venv venv
source venv/bin/activate
Default Env Manager
manager for the workspace toms-python.python:conda
A basic
pyproject.toml
which enables ruff:The fix was to remove the old deactivate directory, but this was very hard to find as it wasn't associated with workspace in any way.
Diagnostic data
No relavent information from python, error was in the Ruff log, failing to configure python extension as it was trying to run the activate from the old environment.
Extension version: 2025.2.0
VS Code version: Code 1.98.0 (Universal) (6609ac3d66f4eade5cf376d1cb76f13985724bcb, 2025-03-04T21:06:18.612Z)
OS version: Darwin arm64 24.3.0
Modes:
Remote OS version: Linux arm64 6.10.14-linuxkit
python.languageServer
setting: DefaultUser Settings
Installed Extensions
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: