Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

752
Views
How to solve unresolved import in VSCode?

I am trying to learn Flask, I use Ubuntu 19.04 and I am writing code in VSCode. After following the attached tutorial, I keep having the problem: unresolved import"flask_mysqldb" and the same with wtforms and passlib.

I have installed all requirements, and just to check, I try to install again and I receive the message:'Requirement already satisfied: mysqlclient in "someplace"/.local/lib/python2.7/site-packages

I thought that maybe I am using python 3.7 but it installs itself in 2.7? But it never asked me where to install.

This is the video tutorial I am following: https://www.youtube.com/watch?v=addnlzdSQs4

from flask import Flask, render_template, flash, redirect, url_for, session, loggin
from data import Articles
from flask_mysqldb import MySQL
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from passlib.hash import sha256_crypt

the first two imports work just fine, the others are underlined with green and receive error messages.

ex:

unresolved import 'flask_mysqldb'

unresolved import 'wtforms'

unresolved import 'passlib.hash'

over 4 years ago · Santiago Trujillo
5 answers
Answer question

0

Have you tried to set the interpreter in VSCode to correct value (including your virtualenv if you have one)?

Open the command palette (Ctrl-Shift-P) and choose "Python: Select Interpreter".

For more details, see: https://code.visualstudio.com/docs/python/environments

over 4 years ago · Santiago Trujillo Report

0

After trying many things and not working ,ended up restarting everything. Erased all the files and did it again. Somehow it worked. Must have been some mistake while setting up.

over 4 years ago · Santiago Trujillo Report

0

Probably, You used command pip install flask-wtf, but it's wrong way. First You have to use command : sudo apt install python3-pip, and next install flask-wtf with command : pip3 install flask-wtf, because you need libraries for python3, not for python2.

over 4 years ago · Santiago Trujillo Report

0

I have had this problem several times and it often works with just "exiting" VSCode since VSCode sometimes doesnt check the path. It uses the "old" settings or "path". By exiting the program and restarting it it updates this and it works (if its this problem)

over 4 years ago · Santiago Trujillo Report

0

I stumbled across this issue while using VSCode with python3 venv.

Premise: While @truth answer pointed me in the right direction, I still could not select the correct interpreter: the right one for me would have been the one created in my venv folder but it wasn't shown on the venv options and even if I browsed to the right folder via the GUI it won't allow me to choose it (because it is a symlink perhaps?)

TLDR: For mac users like me that have python2 installed by default, python3 installed via brew and are using a virtual environment (spawned with python3 -m venv), the solution is the following:

  • save all your work and close VSCode completely ( command+Q )
  • open your terminal and navigate to your project folder. Ensure that your virtualenv is activated
  • open the project from the root folder with: code .
  • open the command palette ( command-Shift-p ) and type "Python select interpreter" and press enter
  • select the interpreter from the list that reference your venv folder

Done, your dependencies should now resolve.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!