1

After I upgraded pip from 8.1.1 to 19.0.1 by running

pip install --upgrade pip

I tried to test the version of pip by running

pip -V

But I got the following error

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

I set the python3 and pip3 to be default by putting the following in ~/.bashrc

alias python=python3
alias pip=pip3

My system is ubuntu 16.04

Blaztix
  • 1,223
  • 1
  • 19
  • 28
Salem Masoud
  • 411
  • 11
  • 32
  • This is a common issue as referenced here : https://github.com/pypa/pip/issues/5221 . – Mohanavel T Jan 29 '19 at 12:14
  • 1
    Possible duplicate of [Error after upgrading pip: cannot import name 'main'](https://stackoverflow.com/questions/49836676/error-after-upgrading-pip-cannot-import-name-main) – Naitik Chandak Jan 29 '19 at 12:40

1 Answers1

2

This is a common issue as referenced here : https://github.com/pypa/pip/issues/5221

You are trying to use the pip, which is shipped with the Debian system. You better try to avoid using that pip at any cost.

Please use python3 -m pip install package instead of the system pip which you have in the debian system.

I also recommend using venv - virtual environments for keeping your system environment safe.

Mohanavel T
  • 371
  • 4
  • 17