I made a venv in vscode using python shell to try it out and accidentally deleted all the venv files before deactivating the venv. Now I can’t deactivate it.
Again, the og files are GONE.
I’ve done some research and simply typing "deactivate" didn’t even work the first time.
Exiting the shell doesn’t work.
Clearing caches doesn’t work.
Uninstalling and reintstalling vscode doesn’t work.
Every time I open the program im in a venv.
Someone please help, I’m at my wits end.
I’ve also tried sudo commands.
The only thing I haven’t tried is commands from my OS cmd prompt. Frankly Im too scared I’ll mess something up in there if I am just going around deactivating stuff.
2
Answers
Have you tried changing your Python interpreter? In the bottom right of the window, just to the left of the notifications bell, you have the version of your Python interpreter and if it’s in a
venv
/conda
virtual environment. If you click on it you will bring up the list of Python interpreters that are currently installed on your computer. Now, click on the 64-bitpython.exe
(the global one). This should get you out of the venv.Accidentally deleted the virtual environment folder before deactivating it properly in VS Code. Since the files are gone, VS Code still thinks the environment is active even though it no longer exists. Here are a few things you can try to reset it:
virtual env.
As a last resort, uninstall and reinstall VS Code. This will reset all its settings.
The key is fully closing VS Code and clearing any cached/config files that still think the venv exists. Doing this should allow VS Code to pick up that the virtual environment is gone and reset itself.
If these steps don’t work then Deleting the VS Code cache/config files can potentially help resolve these issues.
Deleting these folders will remove any cached/configured settings related to the virtual environment that no longer exists. It will reset VS Code’s state and should allow it to detect that the virtualenv is gone.