ezeYaniv
ezeYaniv

Reputation: 570

Packages installed with Poetry fail to import

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:

  1. poetry add sendgrid
  2. In a module, import sendgrid
  3. Error: Import "sendgrid" could not be resolved PylancereportMissingImports

Troubleshooting I've tried:

What is going on?

Upvotes: 8

Views: 13747

Answers (1)

ezeYaniv
ezeYaniv

Reputation: 570

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.

Upvotes: 19

Related Questions