Multiple activation of environment?

Question:

I made virtual environment by using venv module and activated it.

Before I activated it, (base) D:Pythonvenv was shown in terminal. Since I only installed Anaconda and VSCode, I guess this (base) environment was from Anaconda3.

After I activated the virtual environment, it was added in front of (base) interpreter like this : (venv) (base) D:Pythonvenv. Does this mean both environments are in activation? For check, when I typed pip list, it only showed a list of (venv) environment. Then why does (base) environment show? Is it okay not to deactivate (base) when I use (venv)? I’m confused.

Asked By: Donghoon LEE

||

Answers:

Yes, you’ve created multiple virtual environments.

When you start out in the "virtual environments world"it can be quite confusing.

In fact, you can create virtual environments in various ways.

To create a virtual environment, you can use for example :

  • conda
  • venv
  • virtualenv

What you’ve done: you created a virtual environment inside another virtual environment.

First, you created a virtual environment with "venv", and then, inside it, you created a virtual environment with "conda".

In fact, "base" is the default virtual environment of conda:
when you install Anaconda (or miniconda), your python installation is always, by default, in a virtual environement, called "base".

In other words, when you install Anaconda (or miniconda), by default, a virtual environment, called "base", is created.

In my opinion, using a conda virtual environment is enough, no need of "venv".
I would say even more, using a conda virtual environment inside a "venv" virtual environment is too much.

You should uninstall your "env" virtual environment, and after that, just install Anaconda (or miniconda).

You can create other virtual environments than "base" with conda.
Check https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html for more details.

Answered By: Rivers
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.