tape74
tape74

Reputation: 105

Getting "ModuleNotFoundError: No module named 'pip'" while inside of venv

Trying to use a CLI scraper that needs python 3.10 I installed python 3.10 and created the virtual environment using these commands:

sudo apt update && sudo apt -y install python3.10
sudo apt -y install python3.10-dev python3.10-venv
python3.10 -m venv venv
source venv/bin/activate

But then when I try to install the requirements

pip3 install --update -r requirements.txt

I get

Traceback (most recent call last):
  File "/home/alex/scraper/venv/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

While outside of the venv,

pip3 --version

Returns:

pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)

I'm running Pop Os 21.04

Upvotes: 4

Views: 4501

Answers (1)

tape74
tape74

Reputation: 105

latest pip download

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

using the latest pip outside of the venv, python3.10 -m pip

told me the correct usage was

Usage:
/usr/bin/python3.10 -m pip <command> [options]

and that's what worked for me inside the venv

not sure if my python 3.10 is downloading to a weird directory or what

Upvotes: 3

Related Questions