microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.7k stars 769 forks source link

Jupyter Notebooks imports not being resolved #6247

Open the-rich-piana opened 1 month ago

the-rich-piana commented 1 month ago

Environment data

Code Snippet

python
import pandas as pd
from pydantic import BaseModel, Field
from langchain.output_parsers import PydanticOutputParser

from langchain_core.prompts import PromptTemplate
from langchain.schema import HumanMessage
from langchain_openai import ChatOpenAI
import matplotlib.pyplot as plt
import numpy as np
from typing import List
import nest_asyncio

import aiohttp
import asyncio

image

Repro Steps

  1. Import any package or module that is installed via Poetry

Expected behavior

No import errors

Actual behavior

Import "numpy" could not be resolvedPylance[reportMissingImports](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingImports)

Logs

XXX
rchiodo commented 1 month ago

Thanks for the issue. Which kernel have you selected? I assume it's the one matching your poetry environment.

Does the problem go away if you save the notebook and reload the VS code window? If so, then this should be a dupe of https://github.com/microsoft/vscode-jupyter/issues/15965

the-rich-piana commented 1 month ago

Yes it does go away whenI save and reopen the window. Must be a dupe then :+1:

Using my local poetry .venv kernel