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.
EDIT
I found that the way the module is imported makes pylance
to recognize it, but debugger is still raising the error.
This is the old and new way of importing the module into the code:
Old way
New way
With the new way, code is not highlighted by pylance
, but it is not colored as recognized, though.
The problem was finally solved by doing this:
python -m pip install -r requirements.txt