Woww
Woww

Reputation: 374

Unable to use packages (pip) in virtual environment -VS Code

Every-time I create a new virtual environment, I cannot use pip from it. I know that I managed to solve this once, but I dont know how. It just happened.

So here is how I go about creating a venv:

I create a new virtual environment from the VS Code terminal inside my projects folder using python3 -m venv venv_x.

I get the pop-up asking if I want to use it and I click yes. It also gets displayed correctly.

Venv activated

Virtual env location

But when I try to run pip using python3 pip or python pip I get /usr/local/bin/python3: can't open file 'pip': [Errno 2] No such file or directory.

Running which pip gives no putput.

My pyvenv.cfg inside venv_x/pyvenv.cfg :

home = /usr/local/bin
include-system-site-packages = false
version = 3.8.6

What am i doing wrong? It cant be that hard. So I am probably forgetting something obvious.

Every help is greatly appreciated!

Edit: Maybe showing the contents of the venv can help. But after executing a python script VS Code asks me to install my code formatter black, which after accepted, gets installed by the IDE like this:

`.../dev/test/venv_x/bin/python" /Users/chris/.vscode/extensions/ms-python.python-2021.3.680753044/pythonFiles/pyvsc-run-isolated.py pip install -U black' The venv packages folder contents gets updated accordingly and black works.

enter image description here

Upvotes: 1

Views: 1479

Answers (1)

Woww
Woww

Reputation: 374

Using only pip3solved it.

Not using python pipor python3 pip or python3 pip3.

I find that quite weird.

Upvotes: 1

Related Questions