-
Notifications
You must be signed in to change notification settings - Fork 764
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
Unexpected pylance "reportMissingImports" in notebook for local package #3208
Comments
does this happen on the pre-release pylance build? |
No, I do not use the Pre-Release version of the plugin. The version that I am using is |
I am having the same issue, I wonder if it is related to this issue #3017. This comment seems to be something similar. I wonder if that fix has broken absolute imports with "jupyter.notebookFileRoot": "${workspaceFolder}" in settings.json. In my case, I have a folder structure like this:
If I do this in notebook.ipynb (in a cell):
The jupyter notebook file runs correctly, but pylance reports "reportMissingImports" for both the imports. In the past (about a week ago) this worked just fine, no errors being reported. I don't think I have changed anything in my settings. If I do:
Pylance does not report the error and the file runs. |
I met this issue on August 7. (It was the last version of Pylance) I followed the trouble-shooting guide, and found a direct evidence of the working space (aka. the root path, cwd, or whatever.).
The selected row: the root path is VS Code's workspace ( |
For additional information, I did the same procedure as @YDX-2147483647. I put the log file on a pastebin. At the beginning of the log file there are these lines:
It seems that the workspace folder, |
The pre-release |
@AwePhD I was asking whether it is possible that the fix, or attempted fix, to #3017 may have somehow caused this bug. It seemed more than a coincidence that this bug was not present prior to v2022.8.12, and then appeared suddenly after the release. It is the only change I can see related to imports around the time the bug appeared, seemed like something worth pointing out. |
Note these imports get resolved correctly in normal python (non-notebook) files (at least for me), i.e. for a file "notebooks/example.py" with "import lib.data". I noticed I get reportMissingImports when I still have this bug in pre-release v2022.8.51 |
I confirm I also still see the same issue with Pylance |
This issue has been fixed in prerelease version 2022.9.21, which we've just released. You can find the changelog here: CHANGELOG.md |
FYI this doesn't seem fixed when creating and working in a new Jupyter notebook via |
I'm experiencing this in a project. pylance keeps saying that a python module in the same folder than my notebook could not be resolved. I tried to reproduce it in a minimal project of similar structure, to no avail. Then I duplicated the entire project into a new folder, opened it and suddenly it works, but if I now open the original project again it keeps failing to resolve the import as before. It seems like there is some state persisting for the workspace, but I couldn't find any way of cleaning it up. Clear Cache and Reload Window improves nothing. |
@memeplex this issue has been closed for almost two years. It's likely you're seeing something unrelated. Could you please open a new issue? |
Not so sure it's unrelated since I see the issue popping up from time to time and it's always difficult to reproduce, as in my case. FWIW I went for the nuclear option and removed the entire workspaceStorage (I wish there was a more reasonable way but I'm afraid there isn't), opened my workspace again and pylance started behaving ok. So I don't have any hope to reproduce the issue in a way that's worth reporting other than a vague heads up about inconsistent state that is not purged without nuking the workspace. |
Hello,
I think there is a problem with the Python Analysis feature and Notebooks. I searched on SO and in the issues and I did not found anything similar.
Description of the problem
I have the following minimal set-up :
data.py
containsclass A: pass
In
notebook.ipynb
andnotebook_root.ipynb
have a single cell containing:from lib.data import A
Then I have the following :
notebook_root.ipynb
, there is no yellow warning.notebook.ipynb
, there is a pylance warning "reportMissingImports"Additional information
Intellicode properly detects the
A
class while I am typing the import lineI add the following extra settings :
What did I try
I tried to change my option to see if the
${workspaceFolder}
is set. If I change thejupyter.notebookFileRoot
to${foo}
, then thenotebook.ipynb
's cell cannot be run anymore because it cannot find the local package.Although, the other settings do not seem to have any effect. If I change
${workspaceFolder}
to${foo}
then there is no difference for both notebooks.Ask me if you need any additional information.
Have a nice day,
Mathias.
The text was updated successfully, but these errors were encountered: