Khaled Ramadan
Khaled Ramadan

Reputation: 832

Flask always getting reportMissingImports

I'm always getting reportMissingImports regardless if the package installed or not.

app.py:

enter image description here

pip freeze output (in our virtualenv)

aniso8601==8.1.0
click==7.1.2
Flask==1.1.2
Flask-JWT==0.3.2
Flask-RESTful==0.3.8
Flask-SQLAlchemy==2.4.4
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
PyJWT==1.4.2
pytz==2020.5
six==1.15.0
SQLAlchemy==1.3.22
Werkzeug==1.0.1

Flask --version output in my virtual env:

Python 3.9.1
Flask 1.1.2
Werkzeug 1.0.1

My file structure:

/code
 /app.y
 /create_table.py
 /item.py
 /user.py
 /securiy.py
/venv

Note: this is happening for some of the packages and not all of them

Upvotes: 1

Views: 910

Answers (1)

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9481

Add the following code in Settings.json:

"python.analysis.extraPaths": [

    //The relative or absolute path of modules
    "./modules",
    "/the absolute path to flask_jwt/", 
    ...  
],

Then save the settings and reload the window to make it effective.

Upvotes: 1

Related Questions