pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Jupyter Notebooks imports not being resolved

Open the-rich-piana opened this issue 1 year ago • 2 comments

Environment data

  • Pylance version: v2024.8.1
  • OS and version: Pop_OS! 6.8 LTS
  • Python version: 3.10
  • Poetry version: 1.35.0

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

the-rich-piana avatar Aug 08 '24 16:08 the-rich-piana

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

rchiodo avatar Aug 08 '24 16:08 rchiodo

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

Using my local poetry .venv kernel

the-rich-piana avatar Aug 09 '24 19:08 the-rich-piana

Closing via https://github.com/microsoft/vscode-jupyter/pull/15967

luabud avatar Oct 29 '24 18:10 luabud