0

Not able to install packages inside the virtual environment,packages get installed in globally. Can any body help me on this ?

(venv) c:\Final_Framework\Test_Driven_IO>cd venv

(venv) c:\Final_Framework\Test_Driven_IO\venv>pip install flask
Requirement already satisfied: flask in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (2.1.1)
Requirement already satisfied: itsdangerous>=2.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from flask) (2.1.2)
Requirement already satisfied: click>=8.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from flask) (8.1.3)
Requirement already satisfied: Werkzeug>=2.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from flask) (2.2.2)
Requirement already satisfied: Jinja2>=3.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from flask) (3.1.2)
Requirement already satisfied: colorama in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from click>=8.0->flask) (0.4.4)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from Jinja2>=3.0->flask) (2.1.1)

[notice] A new release of pip available: 22.2.2 -> 22.3
[notice] To update, run: python.exe -m pip install --upgrade pip

(venv) c:\Final_Framework\Test_Driven_IO\venv>where pip
C:\Users\soorya\AppData\Local\Programs\Python\Python310\Scripts\pip.exe

(venv) c:\Final_Framework\Test_Driven_IO\venv>
9769953
  • 10,344
  • 3
  • 26
  • 37
surya135
  • 75
  • 1
  • 2
  • 7
  • 2
    [*Please do not post text as images*](https://meta.stackoverflow.com/q/285551). Copy and paste the text into your question and use the code formatting tool (`{}` button) to format it correctly. Images are not searchable, cannot be interpreted by screen readers for those with visual impairments, and cannot be copied for testing and debugging purposes. Use the [edit] link to modify your question. – MattDMo Oct 18 '22 at 16:51
  • 1
    See also https://stackoverflow.com/help/formatting . – 9769953 Oct 18 '22 at 17:14
  • Somehow, your virtual environment wasn't activated, or otherwise not properly set up, since it finds Pip not inside the virtual environment. Check with `where python` first, to see if the Python executable is found inside the virtual environment. – 9769953 Oct 18 '22 at 17:16
  • Is this a duplicate of [this question](https://stackoverflow.com/questions/20952797/pip-installing-in-global-site-packages-instead-of-virtualenv)? – Matt Hall Oct 18 '22 at 17:18
  • https://snarky.ca/why-you-should-use-python-m-pip/ – sinoroc Oct 18 '22 at 19:36

1 Answers1

0

Right now you are using the (default) pip in your standard python installation, not the one in your venv. You can activate the correct virtual environment if you navigate to the correct path and then use

venv\bin\activate

Please also check in your IDE if you have the correct configuration set / selected the correct interpreter.

bitflip
  • 3,436
  • 1
  • 3
  • 22
  • AS you told i moved to the virtual env, and tried to install the flask package using c:\Final_Framework\Test_Driven_IO\venv\Scripts>activate.bat,it is not installing in venv created. (venv) c:\Final_Framework\Test_Driven_IO\venv\Scripts>pip install pytest Requirement already satisfied: pytest in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (7.1.2) Requirement already satisfied: tomli>=1.0.0 in c:\users\soorya\appdata\local\programs\python\python310\lib\site-packages (from pytest) – surya135 Oct 19 '22 at 04:38