-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright/Pylance inconsistency: Unknown import symbol sklearn #6410
Comments
Thanks for the issue. This is because our bundled type stubs don't match your scikit-learn version. The stubs here need to be updated: |
Thanks for the quick response. Should i raise an issue in that repo as well? |
Yeah it wouldn't hurt. Somebody might have the time to update those stubs. |
Took the matter into my own hands: microsoft/python-type-stubs#317 One question though: Is this expected behaviour by pylance? I have read about the differences between pylance and pyright, e.g |
Thanks @einarwar! I just merged your PR. It will show up in next week's prerelease build.
|
This issue has been fixed in prerelease version 2024.9.102, which we've just released. You can find the changelog here: CHANGELOG.md |
Environment data
I have been having an annoyance for some time, where pylance and pyright behaves inconsistently.
Pyright does not flag this as an issue, while pylance gives the error:
When i select
sklearn.metrics -> go to definition
using the python environment where sklearn is installed, i get tosite-packages/sklearn/metrics/__init__.py
whereroot_mean_squared_error
correctly is.If i however select a python interpreter without sklearn installed, when i go to the definition, i am directed to
home/vscode/.vscode-server/extensions/ms-python.vscode-pylance-2024.9.1/dist/bundled/stubs/sklearn/metrics/__init__.pyi
, where the functionroot_mean_squared_error
does not exist.Expected behavior
Would expect pylance to behave as pyright in this case, i.e give no error
Actual behavior
Pylance raises an error, while pyright doesn't
Logs
When checking the output from Python Language Server, there are two entries that might be related:
The text was updated successfully, but these errors were encountered: