basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

Useless message Stub file not found for "[library]"

Open ruben-adhesif opened this issue 1 year ago • 3 comments

When I install and use library (for example pandas), I got this message : Useless message Stub file not found for "pandas" But when I use a library already install (for example os), I have no issues.

image

I work on VSCodium with Windows 11 andPython 3.12.6, this bug happen with basedpyright but not with pyright

ruben-adhesif avatar Oct 01 '24 17:10 ruben-adhesif

this bug happen with basedpyright but not with pyright

this is because reportMissingTypeStubs is enabled by default in basedpyright but not pyright. you can check this by setting typeCheckingMode to "strict" in pyright and you'll probably see the same error.

you need to install https://pypi.org/project/pandas-stubs/ to get its types

DetachHead avatar Oct 02 '24 07:10 DetachHead

perhaps the error message could be expanded?

@ruben-adhesif , what additional information would have helped you here?

KotlinIsland avatar Oct 02 '24 22:10 KotlinIsland

it should probably just guess the name of the stubs package and tell you to try installing it. that would be consistent with what typescript (and i think mypy?) does

DetachHead avatar Oct 02 '24 23:10 DetachHead

perhaps the error message could be expanded?

@ruben-adhesif , what additional information would have helped you here?

If I may offer my own reply to this question as this thread is a little old, I just got this error for the package nltk, and python not being my main language, what would help me is a general methodology around finding and installing these stubs packages. I'm on pypi trying to find something like nltk-stubs, but no luck.

I go to nltk's github and search issues, and there it is. They're still talking about stubs and types; it doesn't sound like they have added typing yet, but maybe there's somewhere else an experienced user might go to check? In TypeScript, for example, I learned one could generally install type packages from @types/<package_name> if it wasn't bundled with the JavaScript package itself.

I imagine for python stubs there might be a similar learned methodology, that I think would benefit the end user to see in this Stub not found error.

michaelmarziani avatar Mar 17 '25 16:03 michaelmarziani

python differs from typescript in that most 3rd party stubs are already bundled with typeshed, so it's more likely that whenever you encounter this error it means there's no stubs to install. pandas seems to be an exception because it's stubs are maintained in a separate repository to typeshed

DetachHead avatar Mar 17 '25 22:03 DetachHead

Good to know, thanks. And thanks for this library, BTW!

michaelmarziani avatar Mar 18 '25 09:03 michaelmarziani