0

For my project I use poetry to install all python 3.10 dependencies. It works.

$ poetry env list
## .venv (Activated)

But in VS Code, Pylint do not recognise any installed library via poetry and the Select interpreter doesn't propose this .venv environment.

How may I declare the right python environment .venv such that pylint find the installed libraries?

I want to get rid of that:

from fastapi import FastAPI
## Unable to import 'fastapi' Pylint(E0401:import-error)
Costin
  • 2,699
  • 5
  • 25
  • 43
  • Does this answer your question? [VSCode doesn't show poetry virtualenvs in select interpreter option](https://stackoverflow.com/q/59882884/225020) – Jab Jun 29 '23 at 13:32
  • Thanks @Jab, I've tried it before asking, doesn't work :( – Costin Jun 29 '23 at 14:18
  • Did you see [this answer](https://stackoverflow.com/a/59957906/225020) to that question? – Jab Jun 29 '23 at 14:37
  • It doesn't work :( """update from 2022, "python.venvPath": is no more available in vscode – Xiang ZHU Oct 16, 2022 at 19:11""" – Costin Jun 29 '23 at 15:31
  • `python.envPath`? – Jab Jun 29 '23 at 15:55
  • Nope, `python.envPath` doesn't do anything – Costin Jun 29 '23 at 16:29
  • The 3rd section in this answer https://stackoverflow.com/questions/68298947/how-to-debug-poetry-application-in-visual-studio-code works, but it is a manual workaround. Do you have any idea how to do it programatically? What should I have in `settings.json`? – Costin Jun 29 '23 at 16:45
  • What does `the Select interpreter doesn't propose this .venv environment` mean? If you select `+ Enter Interpreter Path ...` in the Select Interpreter panel, and then select `.venv` environment interpreter through file management, is it okay? – JialeDu Jun 30 '23 at 05:37
  • @JialeDu When I add the output of `$ poetry env info --path` it works, but this is a manual solution. Is there any reproducible config to make in `.vscode/settings.json`? – Costin Jun 30 '23 at 08:05
  • 1
    You just have to choose an interpreter for the Python extension, you can also set the `"python.defaultInterpreterPath"`, but you still have to choose. – JialeDu Jul 06 '23 at 06:44

0 Answers0