-
Notifications
You must be signed in to change notification settings - Fork 770
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
"Import could not be resolved" after installing the package #6050
Comments
will it go away if you close and re-open the notebook? or if you reload vsocde? |
yes, it goes away if I close and open the notebook. But this is not an option and here is why: I have Spark context running in this notebook, and many initialized pandas dataframes, which are quite hard to calculate. And if I close the notebook and re-open it again, I will have to re-initialize the Spark app, recalculate of my dataframes, etc., which is a hard routine and takes a lot of time. Therefore, keeping a notebook running (even with false errors from pylance) is better than closing and re-opening of it. But anyway, it would be good to have a command in Ctrl + Shift + P named "Pylance: restart scanning of files/notebooks" which would just do the job |
I don't know how the guys from PyCharm team did it, but they re-scan of all installed packages of the current environment just as soon as the new package arrives. It would be good to have this here too. |
I see that this bug in "needs repro" status. I don't know if you noticed this: I provided a notebook file in my original message, together with steps to reproduce. |
This could be this issue here: The root cause of the problem is you change your kernel and we (Pylance) never get told about it. So we think the current interpreter is a different one. That's why Heejae asked if it went away if you closed and opened the notebook, we get the initial interpreter correctly then. |
The log from the Pylance Language Server should tell us which interpreter we think is being used. (If it's the VS code issue I mentioned, it won't match the kernel). |
Type: Bug
The problem is that pylance continues to report error even after package installation.
The sequence of action was as on the picture. Steps to reproduce:
The notebook is attached (rename to ipynb):
kmeans.ipynb.txt
Extension version: 2024.6.1
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:33:48.698Z)
OS version: Linux x64 6.4.6-060406-generic
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: