Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(venv) (base) both active on a python project, how do I get into venv only?

So I am using vscode with conda (for a django project), and trying to activate my virtual environment named "venv". And it goes from:

(base) C:\Users\User\Desktop\pfa-master\pfa-master\venv\Scripts> .\activate

to something like this:

(venv) (base) C:\Users\User\Desktop\pfa-master\pfa-master\venv\Scripts>

And if I try to find out Python version, it shows error like this:

(venv) (base) C:\Users\User\Desktop\pfa-master\pfa-master>which python
'which' is not recognized as an internal or external command,
operable program or batch file.

Note: I have Python in environment variables for anaconda.

What am I doing wrong?

like image 693
Hira Tanveer Avatar asked Feb 23 '26 05:02

Hira Tanveer


2 Answers

You need to deactivate Conda. In terminal, conda deactivate should get rid of (base). When you want to reactivate Conda, conda activate.

like image 175
ms1234 Avatar answered Feb 24 '26 19:02

ms1234


You have two virtual environments active.

conda and virtualenv are both package manager and environment management system :

  • (base) is from conda : https://docs.conda.io/en/latest/
  • (venv) is from virtualenv : https://virtualenv.pypa.io/en/latest/

If you want to use (venv) only, you need to deactivate conda : conda deactivate

If you want to use (base) only, you need to delete the venv directory from your repository : sudo rm -rf venv. Command differs because you are using Windows.

like image 33
noestl Avatar answered Feb 24 '26 18:02

noestl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!