0

I'm extremely new to Python, so I can only apologize for my unadulterated incompetence.

I'm trying to learn to web scrape, so I did pip install requests and that worked fine.

In PyCharm, however, I receive ModuleNotFoundError: No module named 'requests' when I try import requests.

PyCharm offers from pip._vendor import requests to rectify this, but from this I get:

AttributeError: partially initialized module 'pip._vendor.requests' has no attribute 'Session' (most likely due to a circular import)

Any help would be greatly appreciated.

  • 1
    Try this question, maybe there is already an answer: https://stackoverflow.com/questions/17309288/importerror-no-module-named-requests – Oleg Ivanytskyi Jun 03 '20 at 22:02

2 Answers2

0

Try this: python -m pip install requests or this python3 -m pip install requests

Oleg Ivanytskyi
  • 959
  • 2
  • 12
  • 28
0

PyCharm may be using a different python (perhaps from a virtualenv) than the one you pip installed from.

You should also be able to pip install requests from PyCharm's terminal, which should be using the same python as the code you ran.

If you're not using a virtual environment, or similar, I'd highly recommend it. https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html# might be useful for you.

Kirk
  • 1,779
  • 14
  • 20