Having a simple yet confusing issue: a package I added with poetry fails to import when I try to use it in a module. Steps taken:
poetry add sendgrid
import sendgrid
Import "sendgrid" could not be resolved PylancereportMissingImports
Troubleshooting I've tried:
'C:\\Users\\xyz123\\AppData\\Local\\pypoetry\\Cache\\virtualenvs\\nameofproject-py3.10\\lib\\site-packages'
poetry install
gives me the response No dependencies to install or update
What is going on?
Well, it turns out it's a matter of VSCode not playing nice and failing to recognize Poetry's virtual environment. I had to run the Python: Select Interpreter
command and change the venv directory to the one my project is using, then it was able to recognize the installed packages.
See here for more details on how to do that.