Fix: ModuleNotFoundError: No module named pip

>>> import pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'

If you are making use of the pip module in your Python Program or Script, and you get an "ModuleNotFoundError: No module named 'pip'", it could be because of the following reasons.

  1. You do not have the pip module installed. To get it installed, run the below command.

    python install pip
    python3 install pip
  2. If you are making use of a virtual environment venv (say using conda) then make sure pip module is available.

ensurepip — Bootstrapping the pip installer

python3 -m ensurepip

The ensurepip package provides support for bootstrapping the pip installer into an existing Python installation or virtual environment.

Reference: https://docs.python.org/3/library/ensurepip.html

ModuleNotFoundError- No module named pip

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!