Alex Angus
Alex Angus

Reputation: 59

ImportError: cannot import name 'requests'

I am trying to uninstall pip using this command in macOS terminal:

pip uninstall pip

The error I am receiving is:

ImportError: cannot import name 'requests'

I have tried many other commands, some unrelated to uninstalling pip such as:

pip --version

I have tried reinstalling the requests module with

pip install requests

All of them are result in the same error.

ImportError: cannot import name 'requests'

Update: I tried to restore pip to pip 9.0.3 using

pip install --upgrade pip==9.0.3

and I tried importing requests. Both resulted in the same error.

Upvotes: 1

Views: 2609

Answers (1)

Inder
Inder

Reputation: 3816

I am guessing your pip version is 10.+ . It seems to be broken for some users.

what you can do is manually install a pip package from here enter link description here.

Click on download files and download the pip-18.0.tar.gz file.

After that go to your downloads directory and expand the zipped file with a:

tar -xvf pip-18.0.tar.gz

it will expand it to a folder or dir named pip-18.0, do a:

cd pip-18.0

follow that by running the setup.py file with the following command:

python setup.py install

It will work

Upvotes: 1

Related Questions