Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode can't find python's requests library

I've downloaded the requests library with pip install, and I can use it on my command line, and with python's IDLE but not in vscode.

Here is the code from vsc:

import requests

requests.__version__

Here is the error thrown out:

Traceback (most recent call last):
  File "/Users/abdourahman/Desktop/webscrape/igscrape.py", line 1, in <module>
    import requests
ImportError: No module named requests

When run on cmd & IDLE it runs as intended:

Python 3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52)[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests 
>>> 
>>> requests.__version__
'2.23.0'

To reiterate I'd like figure out to access external libraries in my ide. I've run into the same problem with vscode & atom, and with the bs4 library along with requests.

like image 895
adot404 Avatar asked Mar 28 '26 07:03

adot404


1 Answers

Problem was the Code Runner extension I was running source code in vscode out of. Turned it off and it defaulted to running python out of the terminal in vscode which solved the problem of not being able to find the modules.

like image 171
adot404 Avatar answered Mar 29 '26 21:03

adot404