#๐Ÿ”’ Help with venv in vs code

15 messages ยท Page 1 of 1 (latest)

timid umbra
#

Wondering what the benefits of virtual environments in vs code

shut ploverBOT
#

@timid umbra

Python help channel opened

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.

lament ember
#

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.

clear flint
#

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

vocal compass
#

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.

nimble ruin
#

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

tulip silo
#

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

timid umbra
nimble ruin
timid umbra
nimble ruin
#

Well, the several I routinely use (across various scripts).

nimble ruin
shut ploverBOT
#
Python help channel closed for inactivity

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.