Share via

Visual Studio Python Module Not Found

Craig Podczerwinski 26 Reputation points
2023-01-14T21:55:40.1333333+00:00

I'm trying to use Python in Visual Studio 2022 Community Edition.

Whenever I try to import module I get this message. The modules are listed in the Solution Explorer. Can you tell me how the fix this.



Traceback (most recent call last):
  File "D:\Craig\Visual Studio 2022\Projects\PythonPractice\TensorFlowPractice\TensorFlowPractice\TensorFlowPractice.py", line 1, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'
Press any key to continue . . .
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,826 Reputation points Microsoft External Staff
    2023-01-16T06:17:54.4533333+00:00

    Hello @Craig Podczerwinski ,

    Welcome to Microsoft Q&A forum.

    Please check and confirm following aspects:

    1. I believe you installed pandas from VS Python Environments window(View > Other Windows > Python Environments) right? If so, can you confirm that it was installed in the correct location? Normally it should be installed in the default location but the Python runtime you are using might not be loading the modules from the default. If you added different versions of Python environments, please select the correct one and try to use this command py -m pip install pandas and install pandas again.
    2. Please try to create a new Python project, install the pandas and import it directly, and test to see if the pandas module can be found.
    3. Please share us the detailed steps to reproduce this issue and check further if this issue is reproducible.

    Feel free to contact us.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.