#๐ Help with venv in vs code
15 messages ยท Page 1 of 1 (latest)
@timid umbra
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Virtual environments are useful when working with multiple projects because it helps you isolate a project's dependencies from another and avoid dependency conflicts. So that's why it's a nice habit to get into.
venv or an Virtual environments are pretty helpful it helps create a 1. Dependency Isolation 2. Clean Project Dependencies 3. No System Pollution & python version controls
basically when you are in a virtual enviorment whatever you pip install is only in that folder, not on your whole system. its a good way to test things.
It's also a reliable place to install packages. If you're not using a venv your (as a user) have less certainty about which python env's getting your package. On some systems you can install in the "system" python.
We get a fair number of questions like "I installed package X but I can't import it" which are often from "pip install did not install into the particular env I'm using".
@timid umbra
to add to the convo, I want to provide an example:
Imagine you imported a lib called mylib and required a version of 0.0.3. Now imagine you have another project that imports the same library but at a different version. That's what virtual environments aim to solve is how i see it as
Thanks for the insight, I bet this will get necessary as I jump into projects ๐ช
My default (nonproject) Python also comes from a venv.
Does that venv have a lot of libraries installed?
Well, the several I routinely use (across various scripts).
Hmm, on inspection, quite a lot. But many come from dependencies of the particular things I want. Eg installing pandas or matplotlib pulls in lots of other supporting stuff.
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.