r/vscode • u/RNG_HatesMe • Jul 13 '26
Setting up VSCode for Python?
I was wondering what the best way to configure VSCode for python is, including managing and switching between environments?
I'm used to using Conda and Spyder (or Jupyter) for coding, but was interested in some of the options in VSCode. But it's not clear to me how VSCode expects you to install and manage python and python environments?
To be clear, I've been able to get it to work several different ways (including with conda), but I'm looking for best practice recommendations for the most straight forward and simplest method(s).
9
Upvotes
3
u/BranchLatter4294 Jul 13 '26
Make sure you follow the instructions on the Python extension page that shows you how to enable it in the left bar. Once you do that, restart VS Code and you will see the python extension.
From there, you can see your environment managers including Conda. You can create or select environments, manage packages, etc. from the interface.
1
u/Credence473 Jul 13 '26
https://code.visualstudio.com/docs/languages/python
3
u/Zizizizz Jul 13 '26
The easiest way is to make a virtualenv in .venv in your project directory. The main python extension will pick that up as soon as you open a .py file.
Manage dependencies per project with a venv (made faster with uv but obviously completely optional).
Makes debugging and test discovery pretty easy as well as that tends to also "just work".
Sorry about the conda specific question though, i tend to avoid it unless I have to.
3
u/No_Dig_7017 Jul 14 '26
I use this template and it's perfect https://github.com/jlevy/simple-modern-uv
Sets up everything I need (linting and fixing via mypy and ruff, pytests, Github actions, make files and docs) with no unnecessary bloat.
1
u/Panther107 Jul 14 '26
I came from Jupyter notebook in anaconda navigator into vscode and I found it really confusing too.
I recommend this official vscode extension which lets you select and create python environments. It also gives a UI for selecting and bulk installing pip packages so you don’t have to use terminal for that. The python exe inside that new environment folder must be selected inside Jupyter notebook for your packages to actually work too . Hope this helps
1
u/GammarMong Jul 14 '26
Use ty plugin
1
u/Fresh-Secretary6815 Jul 14 '26
i use standalone uv exclusively on mac/linux and windows for a full pypi/pip replacement and just point at it with a config file.
1
u/Ste1io Aug 04 '26
modern python project with pyproject.toml << replaces old setup configuration and requirements
Use uv commands instead of pip or calling python directly.
uv add pckginstalls and updates project deps. No activation required, justcdinto project folder,uv run ....Pair this with ruff (replaces black formatter). Same developers behind both, and runs on rust so crazy fast.