ImportError: cannot import name main while installing EB cli for AWS beanstalk

The beanstalk of AWS requires a EB cli installed to be able to login with the pem file. While I was trying to install the EB client I ran into the following issue:

After updating pip package version, I ran the following command and got the issue.

beroza@:~$ pip install awsebcli --upgrade --user
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main


The error is bit self explanatory and it could not import and throws an import error.

Solution

My pip package was installed from /usr/bin/pip directory. I had to open that and had to modify the following line:
from pip import main

TO 

from pip._internal import main

Comments