2

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

Before I activated it, (base) D:\Python\venv 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:\Python\venv. 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.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
  • It just means that the code that modifies your prompt doesn't remove `(base)` from the prompt before adding `(venv)`. – chepner Oct 06 '20 at 11:40

1 Answers1

1

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.

Rivers
  • 1,783
  • 1
  • 8
  • 27
  • I see. The reason why I made (venv) is to create exe file with minimum file size. I figured when I created .exe file from some .py file by using pyinstaller in (base) environment, the size of the file was about 200 MB. However when I created .exe file from the same .py file in (venv) environment, it was only 12 MB. I don't know why, but someone told me to do that. Would you suggest any other ideas for reducing file size? – Donghoon LEE Oct 06 '20 at 12:34
  • @Donghoon LEE. I see, that's a new question. You could ask a new question on SO (if not already exists). I'm not an expert of pyinstaller, but if think it's because of the "optional dependencies" that modules have in Anaconda, and pyinstaller doesn't make the difference with the "hard dependencies" (really needed). So pyinstaller make an exe with these optional dependencies when you use Anaconda, resulting in a larger .exe file. So, for this purpose, you cloud try to create an new venv and install only the package you need via pip, and so, no Anaconda installation. – Rivers Oct 06 '20 at 13:00
  • @Donghoon LEE. Check this too : https://stackoverflow.com/questions/48629486/how-can-i-create-the-minimum-size-executable-with-pyinstaller – Rivers Oct 06 '20 at 13:04