Python no module named 'requests' even install requests

I run my python scrapy project shows the error no module named 'requests'

So I type pip install requests

and then terminal information:

Requirement already satisfied: requests in ./Library/Python/2.7/lib/python/site-packages (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/2.7/lib/python/site-packages (from requests) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./Library/Python/2.7/lib/python/site-packages (from requests) (1.25.7)
Requirement already satisfied: certifi>=2017.4.17 in ./Library/Python/2.7/lib/python/site-packages (from requests) (2019.11.28)

type command pip list can see request 2.22.0

I type command python --version to check the python version:

python 2.7.16

Finally I run my scrapy project again still see the same error no module named 'requests'

I have no idea how to fix the error now, any help would be appreciated. Thanks.

Install python3 and pip3 and then pip3 install requests

if you are on ubuntu python3 is installed by default

you should first install pip3 by apt install python3-pip and then pip3 install requests

Traps for the Unwary in Python's Import System — Nick Coghlan's , This has changed in Python 3.3: now any directory on sys.path with a name that "<string>", line 1, in <module> ImportError: No module named example.foo. If you have tried all methods provided above but failed, maybe your module has the same name as a built-in module. Or, a module with the same name existing in a folder that has a high priority in sys.path than your module’s. To debug, say your from foo.bar import baz complaints ImportError: No module named bar.

If you are using two different versions of Python, it should explain why you can't use your module.

To install the module on Python 3, try:

pip3 install requests

And make sure, you are using the correct version.

Python error “ImportError: No module named”, To get rid of this error you just need to create __init__.py in the appropriate directory and everything will work fine. To know more about this you� After searching the web for hours i didnt yet find an answer to my problem. I am using Python 3.6 and i cant import selenium. I always get the message "No module named 'selenium'' I tried everythin

Check if you are using the same interpreter to which you have installed the package using pip install. As a best practice to avoid this type of issues when you have multiple versions of python, use pip as a module instead of directly calling pip.

eg:

python -m pip install requests

python3 -m pip install requests

ImportError: No module named 'XYZ' | by Yufeng, If you work on data with Python as I do, nothing should be more familiar to you than the error message in the title. It is probably one of the� Serial is not included with Python. It is a package that you'll need to install separately. Since you have pip installed you can install serial from the command line with: pip install pyserial Or, you can use a Windows installer from here. It looks like you're using Python 3 so click the installer for Python 3.

Python error “ImportError: No module named”, No module named”. 0 votes. My directory tree looks like this: (local directory)/ site-packages/toolkit/interface.py. My code is in here: Or, a module with the same name existing in a folder that has a high priority in sys.path than your module's. To debug, say your from foo.bar import baz complaints ImportError: No module named bar. Changing to import foo; print foo, which will show the path of foo. Is it what you expect? If not, Either rename foo or use absolute imports.

ModuleNotFoundError: No module named 'CommandNotFound , distros) uses Python, I thought apt was a C++ application. You may have better success on a forum specific for your distro, but if. I were you, I� I'm unable to find a module in python ,though easy_install says its already installed. Any idea how to resolve this isseue? $ python -c "from flaskext.sqlalchemy import SQLAlchemy" Traceback (most

How to solve a “no module named” error in Python, make sure that you have typed module name correctly , if it doesn't work, then if you use python 2.x type “pip install 'module name'” if you use python3.x then� Instead of using the doc's command (conda create -n tensorflow pip python=2.7 # or python=3.3, etc.) which wanted to install python2.7 in the conda environment, and kept erroring out saying the module can't be found when following the installation validation steps, I used conda create -n tensorflow pip python=3 to make sure python3 was

Comments
  • have you python3? if yes you have to install requests by pip3 install requests
  • As a side note, since support for Python 2.7 has been officially discontinued, you should consider switching to 3.x.
  • Hmm... If I type pip3 install requests will show the same information. So I have to switch my python version on my mac and install it with pip3 install requests and then run my python project, right ?
  • Thanks for the help. It looks like I have pip3 before.