Saturday, 24 September 2022

vsc python debugger and pylance doesn't recognize installed package

I installed snowflake-connector-python in my virtual environment recently using pip install snowflake-connector-python[pandas]==2.7.6, and it works ok when I run my script from the command line with the virtual environment activated. I set the same virtual environment as VSC interpreter, but trying to run python debugger raises an exeception:

ModuleNotFoundError: No module named 'snowflake.connector'

I also can see that pylance doesn't recognize the package either, but all other installed packages are recognized with no problem.

I have seen several questions and answers for similar cases, but none of them have worked for me.

EDIT

I added the parameter python to the launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "python": "${workspaceFolder}/MyVenv/Scripts/python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": [
                "--env", "dev",
                "--argument"
            ],
            "envFile": "${workspaceFolder}/.env",
        }
    ]
}

Getting the same result.



from vsc python debugger and pylance doesn't recognize installed package

No comments:

Post a Comment