Visual Studio 2022 import xyz could not be resolved from the source

Gui, Feng 21 Reputation points

I upgraded Visual Studio 2022 Enterprise version 17.4.4

I loaded the python project previously configured by Visual Studio 2019. Visual Studio 2022 keeps complaining about Python libraries set up in virtual environment. The virtual environment was configured in Visual Studio 2019 and works in Visual Studio 2019 perfectly. In general, Visual Studio 2022 says import xyz could not be resolved from the source, where xyz could be library such as pandas or sqlarchemy

However, I could run the Python project in Visual Studio 2022 in debug mode without any problems.

I followed advice from

I tried to activate the virtual environment as the post suggested. But it does not work.

Please let me know what I can do to remove the annoying warnings in Visual Studio 2022.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
3,821 questions
{count} votes