VS/Pylance warning: import “module” could not be resolved

We Are Going To Discuss About VS/Pylance warning: import “module” could not be resolved. So lets Start this Python Article.

VS/Pylance warning: import “module” could not be resolved

  1. How to solve VS/Pylance warning: import “module” could not be resolved

    If I understand your problem correctly, your python environment is properly set (for you are able to run your code) but your IDE (Vs code) points import errors.
    That is probably because your IDE does not know which python environment use for your current project (which seems to live somewhere in /home/imantha/workspace/python). You need to set it to get rid of this warning https://code.visualstudio.com/docs/python/environments

  2. VS/Pylance warning: import “module” could not be resolved

    If I understand your problem correctly, your python environment is properly set (for you are able to run your code) but your IDE (Vs code) points import errors.
    That is probably because your IDE does not know which python environment use for your current project (which seems to live somewhere in /home/imantha/workspace/python). You need to set it to get rid of this warning https://code.visualstudio.com/docs/python/environments

Solution 1

If I understand your problem correctly, your python environment is properly set (for you are able to run your code) but your IDE (Vs code) points import errors.

That is probably because your IDE does not know which python environment use for your current project (which seems to live somewhere in /home/imantha/workspace/python). You need to set it to get rid of this warning https://code.visualstudio.com/docs/python/environments

Original Author zar3bski Of This Content

Solution 2

Manage to figure it out.
I was using jupyter in vscode, and in addition changing its (jupyter) environment – which was the correct one,

enter image description here

I also had to change .py file environments (which was a different env before)

enter image description here

And that removed the warnings.

Original Author zar3bski Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

ittutorial team

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment