thecodeadd
thecodeadd

Reputation: 15

Why is python import not working in VS code?

I have downloaded a pip package 'xlrd' to read an excel file. When I try and run the module, the program shows that I have not downloaded that pip. I have not been able to find answers as I did not know what question to ask. How can I fix this?

Message when downloading the pip: 'Requirement already satisfied: xlrd in c:\users\thecodeadd\appdata\local\programs\python\python310\lib\site-packages (2.0.1)' What it shows in 'Problems' for the program:

[{
    "resource": "/c:/Users/thecodeadd/Documents/Stuff/Program/Programs/Python/Trialxlrd.py",
    "owner": "_generated_diagnostic_collection_name_#0",
    "code": {
        "value": "reportMissingImports",
        "target": {
            "$mid": 1,
            "external": "https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules",
            "path": "/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md",
            "scheme": "https",
            "authority": "github.com",
            "fragment": "diagnostic-severity-rules"
        }
    },
    "severity": 4,
    "message": "Import \"xlrd\" could not be resolved",
    "source": "Pylance",
    "startLineNumber": 1,
    "startColumn": 8,
    "endLineNumber": 1,
    "endColumn": 12

}]

Upvotes: 1

Views: 722

Answers (1)

Vivs
Vivs

Reputation: 485

for xlrd python module , you need 2 libraries.

  1. pip install jinja2
  2. pip install xlrd

This should solve your problem

Upvotes: 1

Related Questions